Major Project Report On Chess Game Using Computer Graphics
Major Project Report On Chess Game Using Computer Graphics
Introduction 3
1 1.1 Brief Description
1.2 What a chess game possess?
1.3 Keywords
2 Proposed Objective 5
2.1 Goals of our project
2.2 What our chess game can do?
3 Requirement specification 7
3.1 Software Requirement Specification
3.2 Hardware Requirement Specification
4 Literature Review 9
4.1 Abstract Representation of game
5 Characteristics 11-13
5.1 Standard Definitions
5.2 Product Perspective
5.2.1 System Interfaces
5.2.2 User Interfaces
5.2.3 User characteristics
5.2.4 Constraints
5.2.5 Assumptions & dependencies
5.2.6 Communication Interfaces
5.2.7 Operations
8 Feasibility Study 24
8.1 Technical feasibility
8.2 Operational feasibility
10 Testing 28-29
10.1 System testing
10.2 Alpha testing
10.3 Beta testing
12 Conclusion 39
List of references 40
1
CHAPTER 1
2
Chapter 1. Introduction
1.1 Brief description:
1.3 Keywords:
Chess, hierarchy, artificial intelligence, templates, GUI, inheritance, Java.
3
CHAPTER 2
4
Chapter 2. Proposed Objective
This project implements a classic version of Chess using Java and a Graphical User
Interface. The Chess game follows the basic rules of chess, and all the chess pieces only
move according to valid moves for that piece. Our implementation of Chess is for two
players. It is played on an 8x8 checkered board, with a dark square in each player's
lower left corner.
5
CHAPTER 3
6
Chapter 3. Requirement Specification
These are some certain specifications upon which our project is based upon and with
help of following our “DESIGNING OF CHESS GAME” is able to proceed through
as follows:
7
CHAPTER 4
8
Chapter 4. Literature Review
Computational intelligence techniques were combined with games for the first time in
1959, when Samuel applied a simple reinforcement learning algorithm to the board
game Checkers. After the early success of Samuel, the research in the field
remained silent for a long time. But as part of artificial intelligence research, a few
researchers have worked on applying classical AI techniques, basically especially
custom-made search algorithms, to board games such as Chess and Checkers. This
direction of research ultimately led to the much publicized victory of the IBM Deep
Blue Chess computer over world Chess champion Gary Kasparov in 1997.
The legendary game designer Sid Meier defines a game as “a series of meaningful
choices”. In discussing these and other definitions, game designer Raph Koster also
gave his wonderful effects in “Theory of fun game design” book. According to Koster,
a game is fun to play because we learn the game as we play; we understand
and learn the patterns underlying the game, and finally master how to play it.
Thus Botvinnik for this reason placed games like chess into the class of inexact
problems. As the player cannot in general see the exact influence of a move on the final
goals of the game, it follows that her reasoning must be heuristic. Also S. Russell and
P. Norvig, Artificial Intelligence: A Modern Approach Prentice Hall, 1995 also had the
explanation of using Artificial Intelligence Technique providing a better approach
towards the designing of chess game.
Also the books such as Primer Labs (2013) CODE HERO is a game that teaches how
to make games | Primer Labs, is of great significance for developing the game such as
chess.
Last but not the least a literature review is one described above and the one which is an
evaluative report of information found in the literature related to the selected area of
study, ours is the CHESS.
9
CHAPTER 5
10
Chapter 5. Characteristics
In this scenario we are providing with the basic definitions of the moves of the chess
game. Prior to start the game one must know the basic moves what it is and for what
they are known for.
Chess Board: A board you need to play Chess. Have 64 black and white square.
Player or user: A user or a player will be the person that is playing the chess game.
Pawn: One of eight men of one color and of the lowest value usually moved one square
at a time vertically and capturing diagonally.
King: The main piece of the game, checkmating this piece is the object of the game. It
can move 1 space in any direction.
Knight: This piece can move 1 space vertically and 2 spaces horizontally or 2 spaces
vertically and 1 space horizontally. This piece looks like a horse. This piece can also
jump over other pieces.
Queen: This piece can move in any number of spaces in any direction as long as no
other piece is in its way.
Rook: one of two pieces of the same color that may be moved any number squares
horizontally or vertically, as long as no other piece blocks its way.
Bishop: one of two pieces of the same color that may be moved any number squares
diagonally, as long as no other piece blocks its way. One piece always remains on White
squares and the other always on Black. The bishop has no restrictions in distance for
each move, but is limited to diagonal movement. Bishops, like all other pieces except
the knight, cannot jump over other pieces. A bishop captures by occupying the square
on which an enemy piece sits.
The bishops may be differentiated according to which wing they begin on, i.e.
the king's bishop and queen's bishop. As a consequence of its diagonal movement, each
bishop always remains on either the white or black squares, and so it is also common
to refer to them as light-squared or dark-squared bishops.
11
Check: To make a move that puts the opponents King under direct attack. A check is a
condition in chess that occurs when a player's king is under threat of capture on their
opponent's next turn. A king so threatened is said to be in check. A player must get out
of check, if possible, by interposing a piece between the threatening piece and the king,
capturing the threatening piece, or moving the king to a square where it is no longer in
check. If the player cannot move out of check, the game ends in checkmate and the
player loses. Players cannot make any move that puts their own king in check.
Castling: to move the king two squares horizontally and bring the appropriate rook to
the square the king has passed over. Castling is a move in the game of chess involving
a player's king and either of the player's original rooks. It is the only move in chess in
which a player moves two pieces in the same move, and it is the only move aside from
the knight’s move where a piece can be said to "jump over" another.
Castling consists of moving the king two squares towards a rook on the player's
first rank, then moving the rook to the square over which the king crossed. Castling may
only be done if the king has never moved, the rook involved has never moved, the
squares between the king and the rook involved are unoccupied, the king is not in check,
and the king does not cross over or end on a square in which it would be in check.
Castling is one of the rules of chess and is technically a king move.
En Passant: a method by which a pawn that is moved two squares can be captured by
an opponent's pawn commanding the square that was passed. A maneuver in chess
which is performed after a player moves a pawn two squares forward from its starting
position, and an opposing pawn captures it as if it had only moved one square.
Stalemate: A situation in which a player’s king is not in check, but that player can make
no move. This then results is a stalemate, which is a draw.
University students need an entertainment tool to enjoy and play with friends over the
network as described in chapter 1 of this report, CHESS intend to fill this need by
providing a software allows entertainment with friends and over the network. Some
software games allow playing games with people that you may not know, and often
times require a monthly fee for the service.
12
5.2.1 System interfaces:
CHESS software integrates two internal systems to provide functionality:
Client CHESS software has an interface to the user’s client to receiver user input and
moves selections for the game
Network CHESS software has an interface to the network in order to transmit
information and connect players.
Connect interface is used by game players and display player information. As players
make moves, the screen is updated to reflect the moves made in the game.
5.2.4 Constraints:
CHESS may experience hardware limitations constraint for graphics and Java language
requirements if installed in a not compatible computer.
5.2.7 Operations:
CHESS not provide backup or recovery operations.
13
CHAPTER 6
14
Chapter 6. Proposed Methodologies
The text-based game uses upper and lowercase letters for the chess pieces for players 1
and 2. The blank pieces are indicated with a '-' and there is a number grid provided for
easier input of the coordinates of squares. The player is prompted to input the
coordinates of the piece to be moved, and where to move it. We decided that because
chess is a complicated game with many rules, we would not be able to implement all
its functionality. Starting with testing the simpler functions and gradually working up
to playing chess matches, we tested the text-based version for functionality. Designing
and debugging the text-based version was challenging, but because we are familiar with
Java there were not many problems.
This GUI program was very easy to use to design the interface, including buttons for
the squares of the chess board and a message box. The message box was useful in
keeping the player apprised of whether a move was valid and various other pertinent
information. Many of the button functions and properties made it a very logical choice
for an implementation of chess. Some examples of the helpful properties are
background color and foreground image. They allowed for easy specification of square
color and served as a container for the piece bitmaps. Functions such as setImage()
allowed for rapid and easy modification of these properties and were invaluable. Using
buttons was the most logical choice for the user interface, as the vast majority of chess
GUIs use clickable zones for input. One of the largest challenges was integrating the
15
text-based game code with the GUI. Once everything compiled, we had issues with
move and other functions, that didn’t make a perfect transition to forms. Several major
changes in implementation were required due to our lack of experience with designing
for GUIs. Functional coding for the buttons became much simpler when we created a
function called handleButtonPress rather than copying and pasting the same logic into
each button. Despite the difficulties, the GUI version of the Chess game was complete.
Minimax is an algorithm used to determine the score in a zero-sum game after a certain
number of moves, with best play according to an evaluation function. Here we have
used the minimax approach.
The algorithm can be explained like this: In a one-ply search, where only move
sequences with length one are examined, the side to move (max player) can simply look
at the evaluation after playing all possible moves. The move with the best evaluation is
chosen. But for a two-ply search, when the opponent also moves, things become more
complicated. The opponent (min player) also chooses the move that gets the best score.
Therefore, the score of each move is now the score of the worst that the opponent can
do.
We are utilizing a tree to generate the possible chessboard with depth first search and
minimax to find the best move based on the following heuristics:
16
6.5 Execution of Chess:
After the GUI window appears upon execution, the first player (white chess pieces)
clicks on the piece that (s)he would like to move and then clicks on a valid position for
this piece (including capturing another piece, which then disappears from the board).
Invalid moves are not allowed, and the message box notifies the player of the problem.
A player is also not allowed to move another player's pieces. The message box tells the
player when (s)he is in check, and the player must move the King to get out of check.
The majority of the time, however, our Chess game worked well.
For designing the system for chess following aspects need to be kept in mind:
Practicality, the system must be stable and can be operated by people with average.
Cost, it is desirable to aim for a system with a minimum cost subject to the condition
that it must satisfy all the requirements.
Flexibility, the system should be modifiable depending on the changing needs of the
user. Such modifications should not entail extensive reconstructing or recreation of
software. It should also be portable to different computer systems.
Security, this is very important aspect of the design and should cover areas of hardware
reliability. System design involves first logical design and then physical construction
of the system.
17
CHAPTER 7
18
Chapter 7. System Design
System design is the process of defining the components, modules, interfaces, and data
for a system to satisfy specified requirements. System development is the process of
creating or altering systems, along with the processes, practices, models, and
methodologies used to develop them.
19
FIG 7.1.2 REDO MOVE
20
7.2 ER-Diagram:
21
7.3 State Diagram:
22
CHAPTER 8
23
Chapter 8. Feasibility Study
On the basis of outcome of initial investigation, feasibility takes place. The main goal
of feasibility study is not to resolve the problem but to accomplish the scope. In the
process of feasibility study, the cost and the benefits are estimated with greater
accuracy.
24
CHAPTER 9
25
Chapter 9. Proposed Evaluation Method
The main limitation of the previous system of Chess Game (2 player) is -
• The existing system only provides text-based interface, which is not as user-
friendly as Graphical user Interface.
• Since the system is implemented in Manual, so the response is very slow.
Hence, there is a need of reformation of the system with more advantages and
flexibility. Our Chess Game (2 player) eliminates the limitations of the existing
software.
9.1 Enhancement:
The main objective of Chess Game is to enhance and upgrade the existing system by
increasing its efficiency and effectiveness. The software improves the working methods
by replacing the existing manual system with the computer-based system.
9.2 Automation:
The Chess Game (2 player) automates each and every activity of the manual system
and increases its throughput. Thus the response time of the system is very less and it
works very fast.
9.3 Accuracy:
The Chess Game (2 player) provides the uses a quick response with very accurate
information regarding the users etc. Any details or system in an accurate manner, as
and when required.
9.4 User-Friendly:
The software Chess Game (2 player) has a very user-friendly interface. Thus the users
will feel very easy to work on it. The software provides accuracy along with a pleasant
interface. Make the present manual system more interactive, speedy and user friendly.
26
CHAPTER 10
27
Chapter 10. Testing
Testing is a process, which reveals error in the program. It is a major quality measure
employed during software development. During testing the program is executed with a
set of test cases and the output of the program with test cases is evaluated to determine
if the program is performing as it is expected to perform. In order to make sure that the
system doesn’t have errors there are the different levels of testing strategies which are
applied at different phases of software development.
Plan and design the test: In this, we make test plan document with every new
prototype of the game and revisit the code and update if any change is there in the
specification. We insure that no new issues were introduced.
Prepare the test: In this, we have updated our code, tests, document and align it with
one another.
28
Perform the test: In this, we have run the test suit again. If any defect is found, we test
around the defect to make sure that the bug is certain.
Report the results: In this, we have reported the complete details about the bugs.
Repair the bugs: In this, we provide the direct testing to track the bug and repair it.
Return to step 1 and retest: In this, we return to the step 1 and retest the other
prototype of the game in the same manner.
29
CHAPTER 11
30
Chapter 11. Project Snapshots
11.1 Chess-Board:
31
11.2 Flipboard Rotation:
32
11.3 Highlighting Legal Moves:
33
11.4 Movement of Piece:
34
11.5 En-Passant Rule:
35
11.6 Pawn Promotion:
36
11.7 Check:
37
CHAPTER 12
38
Chapter 12. Conclusion
The project had two aims, all of them which were achieved. The aims of the project
were important as they identified what the project was trying to achieve. Their aims
were:
• First aim is to allow two users or players to play the game interactively from
remote locations.
• The second aim is that the java program for the chess game should be working
properly and allow the users to play the game.
The final report for the project was good, as it showed how the academic question was
created from the initial problem. The next section of the report was the literature review,
which contained quality sources from various different formats such as books, journals
and websites. The sources gave excellent background knowledge of the topic and aided
in answering the academic question.
The planning for the project was very well carried out as it initially had two weeks of
slack available. This allowed for leniency if any task took longer than anticipated. All
tasks were completed in the order they were anticipated.
The artefact was superbly developed and implemented. Findings from the literature
review was used to ensure that the game covered several different learning styles. Some
limitations of the chess game were found from the usability test results, which identified
that some features were missing that could have enhanced the user experience.
The testing methods used in the project were appropriate. The system test ensured that
all features of the chess game were functional before the beta test. There was no other
suitable tests found that would test the game as thoroughly as the system test.
39
List of References
[1] S. Russell and P. Norvig, Artificial Intelligence: A Modern Approach Prentice Hall,
1995.
[4] http://www.jenovachen.com/flowingames/designfig.htm
https://en.wikipedia.org/wiki/Flow_(video_game)
[6] Primer Labs (2013) CODE HERO is a game that teaches how to make games |
Primer Labs [Online]. US: Primer Lab.
Available at: <http://primerlabs.com/codehero>.
[11] www.ntpel.ac.in
40