Вы находитесь на странице: 1из 41

TABLE OF CONTENTS

Chapter Title Page No.

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

6 Proposed Methodologies 15-17


6.1 Our approach
6.2 Text based chess game
6.3 Graphical user interface
6.4 Mini-Max Algorithm
6.5 Execution of chess
7 System Design
7.1 Flowcharts 19-22
7.2 ER-diagram
7.3 State diagram

8 Feasibility Study 24
8.1 Technical feasibility
8.2 Operational feasibility

9 Proposed Evaluation Method 26


9.1 Enhancement
9.2 Automation
9.3 Accuracy
9.4 User-friendly
9.5 Maintenance cost

10 Testing 28-29
10.1 System testing
10.2 Alpha testing
10.3 Beta testing

11 Project Snapshots 31-37


11.1 Chess-board
11.2 Flipboard rotation
11.3 Highlighting legal moves
11.4 Movement of piece
11.5 En-Passant rule
11.6 Pawn Promotion
11.7 Check

12 Conclusion 39

List of references 40

1
CHAPTER 1

2
Chapter 1. Introduction
1.1 Brief description:

The project ‘DESIGNING OF CHESS GAME USING COMPUTER GRAPHICS’


implements a classic version of Chess with a Graphical User Interface (GUI). 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
(use of Artificial Intelligence). It is played on an 8x8 checked board, with a dark square
in each player's lower left corner.
We successfully created a GUI using text-based version, inheritance and templates, as
specified. Despite several unusual bugs in the GUI, our Chess program is a great, user-
friendly game for two players.

1.2 What a chess game Possess?


Chess is a game played by 2 people on a chessboard with 16 pieces each. Our project
implements the chess game with 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 (no artificial intelligence). It
is played on an 8*8 checkered board, with a dark square in each player’s lower left
corner.

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.

2.1 Goals of our Project:


1. First goal is to allow two users or players to play the game interactively from
remote locations.
2. The second goal will be that the program should be working and allow the users
to play the game.

2.2 What our chess game can do?


 IMPROVES PROBLEM SOLVING TECHNIQUES
 IMPROVE LOGIC AND REASONING SKILLS
 INCREASE PATIENCE AND PERSISTENCE
 IMPROVES DECISION-MAKING SKILLS

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:

3.1 Software Requirement Specification:


Language: JAVA with graphics (JAVA 5 Environment).

Platform: Windows operating system.

Software: Intelli J idea IDE software.

3.2 Hardware Requirement Specification:


RAM: 128MB (Minimum).

Processor: Pentium 2 and above.

Hard Disk: 150 MB.

Includes Memory Storage, a mouse, a keyboard.

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.

4.1 Abstract Representation of a Game:

An abstract representation of a game is a set of rules which allow a player to


play the game lawfully, but which is more compacted than the general representation
of the game. The concept of abstract representation is basic to all work on games
in AI. It is a prerequisite for game analysis. Thus game analysis is significantly
dependent on the existence of an abstract representation of the 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.

5.1 Standard Definitions:

Chess Board: A board you need to play Chess. Have 64 black and white square.

Chess: A game played by 2 people on a chessboard with 16 pieces each.

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.

Checkmate: a situation in which an opponent’s king is in check and it cannot avoid


being captured. This then brings the game to a victorious result.

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.

En passant may only be played immediately after a two-square square pawn


advance, or the right to capture "in passing" is lost. After pawns were granted the ability
to move two squares on their first move, the En passant rule was introduced in 1490 to
prevent pawns from having too much power or freedom. En passant captures are use in
chess composition.

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.

5.2 Product perspective:

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.

5.2.2 User interfaces:


CHESS includes an interface resembling a common chessboard. CHESS require Java
5 installed, memory space and storage space on the user computer to save data.
Furthermore, the computer will need memory space because CHESS is only accessible
to computers what had installed the application. However, CHESS is not portable and
the clients will need to install one time the chess application on each computer that will
be used to play.

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.3 User characteristics:


The user of CHESS need experience and be able to play chess at least a basic level.
Furthermore, user needs to be very familiar and the comprehended chess rules.

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.5 Assumptions and dependencies:


CHESS is not platform dependence and can be installed in any operating system
capable to run Java 5 environment.

5.2.6 Communications interfaces:


Communication between the clients is facilitated by common network protocols using
TCP/IP.

5.2.7 Operations:
CHESS not provide backup or recovery operations.

13
CHAPTER 6

14
Chapter 6. Proposed Methodologies

6.1 Our Approach:


We started by planning the hierarchy of our chess game. This organized our plan for
coding and setting up the class hierarchies. Next we began coding of the Chess game.
Initially we worked together on developing the header files so that we knew what
functions and logic we should use.

6.2 Text-Based Chess Game:

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.

6.3 Graphical User Interface:

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.

6.4 Mini-Max Algorithm:

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:

1. material (total piece count for each player)


2. number of possible legal moves with emphasis on center squares
3. check/checkmate status
4. pawn structure

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.

Efficiency, this involves accuracy, timeliness and comprehensiveness to the system


output.

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.

7.1 Flow Charts:

FIG 7.1.1 MOVE

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.

8.1 Technical Feasibility:


The technical feasibility of our project ‘DESIGNING OF CHESS GAME USING
COMPUTER GRAPHICS’ as it use mostly java language which is platform
independent and today most of the applications are java based only. The java
technology used in this project work is well suited.

8.2 Operational Feasibility:


It is measured by the usage of the system after the implementation and resistance from
the user.

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.

9.5 Maintenance Cost:


Reduce the cost of maintenance.

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.

10.1 System Testing:


Testing plays a very important role in games. We have tested our game at different level
of its development process. Generally, we have used black box testing to test our game.
In this, we have tested small pieces of code before submit it for the integration with the
rest of the game. Below diagram shows the basic cycle of game testing.

FIG 10.1 TESTING LIFE CYCLE

This cycle is performed in the following six steps in order:-

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.

Game testing is performed in a structured manner. It is irrespective of the size of the


game and time required for producing game.

10.2 Alpha Testing:


The main testing begins in this step. In this we play the game from start to finish along
some path and revised it. All modules of the game are tested at least for once.

10.3 Beta Testing:


Beta testing begins right after the end of alpha test. In beta testing, we focus mostly on
perfecting the game. Beta test identifies and fixes the remaining bugs. It is usually
performed by the end user not by the developer. The end user play the game along all
possible path, the entire user interface and game logic is final, all controllers work and
final artwork & audio is implemented.

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

In this project “DESIGNING OF CHESS GAME USING COMPUTER GRAPHICS”


we presented the classic and standard version of Chess implemented as a GUI. We
successfully created a game using inheritance, templates, Artificial Intelligence and a
GUI (Graphical User Interface).

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.

The benefits are –

 A GUI user interface which help us to work with great ease.


 Chess program is a great, user-friendly game for two players by the use of
Artificial Intelligence.

39
List of References

[1] S. Russell and P. Norvig, Artificial Intelligence: A Modern Approach Prentice Hall,
1995.

[2] Bratko, P. Tancig, and S. Tancig, “Detection of positional patterns in chess”, in


Advances in Computer Chess 4.

[3] H. Berliner, D. Kopec, and E. Northam, “A taxonomy of concepts for evaluating


chess strength,” in Proceedings of the 1990 ACM/IEEE Conference on
Supercomputing.

[4] http://www.jenovachen.com/flowingames/designfig.htm
https://en.wikipedia.org/wiki/Flow_(video_game)

[5] Koster, R. (2005) a Theory of Fun for Game Design. Scottsdale,


Arizona: Para glyph.

[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>.

[7] Programming in java by Balaguruswamy

[8] Computer Science by Sumita Arora

[9] Software Engineering by Roger Pressmen

[10] Computer Graphics by Hearn & Baker

[11] www.ntpel.ac.in

40

Вам также может понравиться