Sunteți pe pagina 1din 10

CHESS GAME WITH TWO PLAYERS

1. Introduction

My goal is to implement a completely functional chess program. This game is meant for two
human opponents to play against each other. A game of chess involves chess pieces, and a chess
board.

At the beginning of the game the chessboard is laid out so that each player has the white (or
light) color square in the bottom right-hand side. The chess pieces are then arranged the same
way each time. The second row (or rank) is filled with pawns. The rooks go in the corners, then
the knights next to them, followed by the bishops, and finally the queen, who always goes on her
own matching color (white queen on white, black queen on black), and the king on the remaining
square.

The player with the white pieces always moves first. Therefore, players generally decide who
will get to be white by chance or luck such as flipping a coin or having one player guess the
color of the hidden pawn in the other player's hand. White then makes a move, followed by
black, then white again, then black and so on until the end of the game.

2. Literature Review and Rules

The Objective of Chess

The objective in chess is to checkmate your opponents King, and there are three potential ways
the game can end:

 you can checkmate your opponent. This means that the King is in check (under potential
attack from an opposing chess piece) and the player can not make any legal move to
remove the King from check. At this point, the game is over and the checkmated player
loses. The amount of material on the chessboard is of no concern.
 Second, you and your opponent can reach a stalemate - the opponents King is not
currently in check, but would be force to move in to check with their next move.
Because you can never put your own King in check, you would have no legal moves to
make. A stalemate does not mean the attacking player has won. Instead, it is a draw -
neither player is victorious.
 In timed games, each player has a specific amount of time to make their moves. Once
their time runs out, they lose, regardless of the material on the board. That means that
you could have only your King legt and deftly avoid mate attempts from an opponent
with most of their chess pieces still on the chess board and still win the game if your
opponent were to run out of time.

HISTORY
The rules of chess have evolved much over the centuries from the early chess-like games played
in India in the 6th century. For much of that time the rules have varied from area to area. The

1|Page
modern rules first took form in Italy during the 13th century, giving more mobility to pieces that
previously had more restricted movement (such as the queen and bishop). Such modified rules
entered into an accepted form during the late 15th century or early 16th century. The basic
moves of the king, rook, and knight are unchanged. Pawns originally did not have the option of
moving two squares on their first move and promoted only to a queen if they reached the eighth
rank. The queen was originally the fers or farzin, which could move one square diagonally in any
direction. In European chess it became able to leap two squares diagonally, forwards, backwards,
or to left or right on its first move; some area also gave this right to a newly promoted pawn. In
the Persian and Arabic game the bishop was a pīl(Persian) or fīl (Arabic) (meaning "elephant")
which moved two squares diagonally with jump. In the Middle Ages the pawn could only
be promoted to the equivalent of a queen (which at that time was the weakest piece) if it reached
its eighth rank. During the 12th century the squares on the board sometimes alternated colors,
and this became the standard in the 13th century, whence the word "chequered"/"checkered".

The Board

The chess board is an 8 by 8 grid. The initial configuration of the pieces is as follows:

Where R = rook, N = knight, B = bishop, Q = queen, K = king, P = pawn

The Pieces

1. Pawns
a. Normally move forward one space.
b. Move diagonal one space to kill.
c. May move two spaces forward on the first move.
i. But may be killed En Passant after this move by attacking the space
behind the pawn.
d. May be exchanged for any piece except a King by reaching the opposite side of
the board.
2. Bishops

2|Page
a. Move diagonally any distance.
b. Kill by landing on a space occupied by an opponent's piece.
3. Knights
a. Move in "L" shape (one space one direction, two in a perpendicular direction).
b. May go "over" other pieces.
c. Kill by landing on a space occupied by an opponent's piece.
4. Rooks
a. Move horizontally or vertically any distance.
b. Kill by landing on a space occupied by an opponent's piece.
c. May "castle" with the king under certain circumstances (see below).
5. Queens
a. Move any distance horizontally, vertically, or diagonally.
b. Kill by landing on a space occupied by an opponent's piece.
6. Kings
a. Move one space horizontally, vertically, or diagonally.
b. Kill by landing on a space occupied by an opponent's piece.
c. May "castle" with a rook under certain circumstances (see below).
d. The game is over:
i. when the opponent's king cannot escape being taken ( i.e. Checkmate ).
ii. or one player can make no move without putting his / her king in danger
(i.e. Stalemate)

7. Castling
One other special rule is called castling. This move allows you to do two important
things all in one move: get your king to safety (hope fully), and get your rook out of the
corner and into the game. On a player’s turn he may move his king two squares over to
one side and then move the rook from that side’s corner to right next to the king on the
opposite side. (See the example below.) However, in order to castle, the following
conditions must be met:

 it must be that king’s very first move


 it must be that rook’s very first move
 there cannot be any pieces between the king and rook to move
 the king may not be in check or pass through check
 Notice that when you castle one direction the king is closer to the side of the board. That
is called castling kingside. Castling to the other side, through where the queen sat, is
called castling queenside. Regardless of which side, the king always moves only two
squares when castling.

3|Page
8. En passant

When a pawn advances two squares from its original square and ends the turn adjacent to a pawn
of the opponent's on the same rank, it may be captured by that pawn of the opponent's, as if it
had moved only one square forward. This capture is only legal on the opponent's next move
immediately following the first pawn's advance. The diagrams on the right demonstrate an
instance of this: if the white pawn moves from a2 to a4, the black pawn on b4 can capture it en
passant, moving from b4 to a3 while the white pawn on a4 is removed from the board.

9. Check & Checkmate

As stated before, the purpose of the game is to checkmate the opponent’s king. This happens
when the king is put into check and cannot get out of check. There are only three ways a king
can get out of check: move out of the way (though he cannot castle!), block the check with
another piece, or capture the piece threatening the king. If a king cannot escape checkmate then
the game is over. Customarily the king is not captured or removed from the board, the game is
simply declared over.

10. Draws

Occasionally chess games do not end with a winner, but with a draw. There are 5 reasons why a
chess game may end in a draw:

 The position reaches a stalemate where it is one player’s turn to move, but his king is
NOT in check and yet he does not have another legal move
 The players may simply agree to a draw and stop playing
 There are not enough pieces on the board to force a checkmate (example: a king and a
bishop vs. a king)
 A player declares a draw if the same exact position is repeated three times (though not
necessarily three times in a row)
 Fifty consecutive moves have been played where neither player has moved a pawn or
captured a piece.

4|Page
11. Resigning
Either player may resign at any time and their opponent wins the game. This normally happens
when the player believes he or she is very likely to lose the game. A player may resign by saying
it verbally or by indicating it on their score sheet in any of three ways:
(1) by writing "resigns",
(2) by circling the result of the game, or
(3) by writing "1–0" if Black resigns or "0–1"
if White resigns. Tipping over the king also indicates resignation, but it is not frequently used
(and should be distinguished from accidentally knocking the king over). Stopping both clocks is
not an indication of resigning, since clocks can be stopped to call the arbiter. An offer of a
handshake is not necessarily a resignation either, since one player could think they are agreeing
to a draw.
Illegal move
A player who makes an illegal move must retract that move and make a legal move. That move
must be made with the same piece if possible, because the touch-move rule applies. If the illegal
move was an attempt to castle, the touch-move rule applies to the king but not to the rook. The
arbiter should adjust the time on the clock according to the best evidence. If the mistake is only
noticed later on, the game should be restarted from the position in which the error occurred.
Some regional organizations have different rules.
If blitz chess is being played (in which both players have a small, limited time, e.g. five minutes)
the rule varies. A player may correct an illegal move if the player has not pressed their clock. If a
player has pressed their clock, the opponent may claim a win if he or she hasn't moved. If the
opponent moves, the illegal move is accepted and without penalty.
According to the FIDE Laws of Chess, the first completed illegal move is penalized by awarding
the opponent two additional minutes on the clock. The second completed illegal move by the
same player results in the loss of the game, unless the position is such that it is impossible for the
opponent to win by any series of legal moves (e.g. if the opponent has a bare king) in which case
the game is drawn. A move is completed when it has been made and the player has pressed the
clock.[12] In rapid chess and blitz chess, the first completed illegal move results in a loss.
Illegal position
If it is discovered during the game that the starting position was incorrect, the game is restarted.
If it is discovered during the game that the board is oriented incorrectly, the game is continued
with the pieces transferred to a correctly oriented board. If the game starts with the colors of the
pieces reversed, the game continues (unless the arbiter rules otherwise). Some regional
organizations have different rules.
If a player knocks over pieces, it is their responsibility to restore them to their correct position on
their time. If it is discovered that an illegal move has been made, or that pieces have been

5|Page
displaced, the game is restored to the position before the irregularity. If that position cannot be
determined, the game is restored to the last known correct position.

 Chess has a very extensive literature. In 1913, the chess historian H.J.R. Murray
estimated the total number of books, magazines, and chess columns in newspapers to be
about 5,000. [1]
 David Hooper and Kenneth Whyld write that, "Since then there has been a steady
increase year by year of the number of new chess publications. No one knows how many
have been printed." [2]
 There are two significant public chess libraries: the John G. White Chess and Checkers
Collection at Cleveland Public Library, with over 32,000 chess books and over 6,000
bound volumes of chess periodicals; [3]
 The Chess & Draughts collection at the National Library of the Netherlands, with about
30,000 books. [4]

3. Analysis - Phases
Opening

A chess opening is the group of initial moves of a game (the "opening moves"). In some opening
lines, the exact sequence considered best for both sides has been worked out to more than 30
moves. Professional players spend years studying openings and continue doing so throughout
their careers, as opening theory continues to evolve.

The fundamental strategic aims of most openings are similar

 Development: This is the technique of placing the pieces (particularly bishops and
knights) on useful squares where they will have an optimal impact on the game.
 Control of the center: Control of the central squares allows pieces to be moved to any
part of the board relatively easily, and can also have a cramping effect on the opponent.
 King safety: It is critical to keep the king safe from dangerous possibilities. A correctly
timed castling can often enhance this.
 Pawn structure: Players strive to avoid the creation of pawn weaknesses such as isolated,
doubled, or backward pawns, and pawn islands – and to force such weaknesses in the
opponent's position.

Middlegame

The middle game is the part of the game which starts after the opening. There is no clear line
between the opening and the middlegame, but typically the middlegame will start when most

6|Page
pieces have been developedBecause the opening theory has ended, players have to form plans
based on the features of the position, and at the same time take into account the tactical
possibilities of the position. The middlegame is the phase in which most combinations occur.
Combinations are a series of tactical moves executed to achieve some gain. Middlegame
combinations are often connected with an attack against the opponent's king;

Specific plans or strategic themes will often arise from particular groups of openings which
result in a specific type of pawn structure. An example is the minority attack, which is the attack
of queenside pawns against an opponent who has more pawns on the queenside. The study of
openings is therefore connected to the preparation of plans that are typical of the resulting
middlegames.

End game

The end game (or end game or ending) is the stage of the game when there are few pieces left on
the board. There are three main strategic differences between earlier stages of the game and
endgame

 During the endgame, pawns become more important; endgames often revolve around
attempting to promote a pawn by advancing it to the eighth rank.
 The king, which has to be protected in the middlegame owing to the threat of checkmate,
becomes a strong piece in the endgame. It is often brought to the center of the board
where it can protect its own pawns, attack the pawns of opposite color, and hinder
movement of the opponent's king.

How to Play the game :

1) Set the board so that the bottom right square is a white square. White pieces will be set up in
the bottom two rows, and black in the top two. ("Top" and "bottom" here are described from the
perspective of the "white" player.)

2) Place the white pawns along the second row from the bottom, and the black pawns in the
second row from the top. Pawns are the basic infantrymen of chess. While other chess pieces can
be moved various distances in various directions, pawns are usually quite limited in their
movements.
 Pawns can only move forward. They can generally move only to the square directly in
front of them. One exception to this rule applies to each pawn's first move of the game,
when they can move either one or two spaces forward. For the rest of the game they are
limited to moving one square forward (with a notable exception discussed next).
 A pawn can "capture" (remove from the game) an opponent's piece if that piece stands on
a square that is diagonally one square in front of the pawn. Pawns cannot capture pieces
directly in front, back, or to the sides of it.

7|Page
Place the rooks in each corner. Rooks move horizontally and vertically as far as they want,
provided the space they move through is unoccupied. If they like, they can end their move by
landing on and capturing an opponent's piece.

 A rook is sometimes referred to as a tower, marquess, or castle, although the term


"castle" is not often used instead of "rook," because "castle" has another chess meaning,
too.
 Place the knights in the squares directly beside the rooks. Knights move in an "L" shape:
either two squares horizontally and one square vertically, or two squares vertically and
one square horizontally. The knight is the only piece that can be moved at the beginning
of a game other than a pawn (since all the other pieces are blocked by pawns).
 Knights can "jump" over other pieces, a unique ability among chess pieces. Therefore, if
another piece is in the way of its "L" path, a knight can travel over it in order to get to its
end destination. Unlike in checkers, this jumping over does not result in the capture of
opponent's pieces.

Place the bishops in the squares directly beside the knights. Bishops move forward and backward
diagonally through any unoccupied squares. If they like, they can end a move by landing on and
capturing an opponent's piece. Unique among chess pieces, a bishop will spend the entire game
on squares of the same color. In other words, one white bishop will spend the whole game on
white squares only. The other white bishop will spend the game on black squares only. The same
is true for the black bishops.

Place the white queen on the open white square in the bottom row. The black queen goes on the
open black square in the top row. In other words, each queen starts out on a square of her own
color. Queens can move forward and backward vertically, horizontally, and diagonally. They can
move in a straight line as many squares as are unoccupied (and can finish a move by landing on a
square occupied by an opponent's piece and capturing that piece.) They are effectively a rook and
a bishop combined.

Place the kings in the last remaining open squares. They each begin on a square of the opponent's
color. Kings can move horizontally, vertically, and diagonally, but only one square at a time.
This makes them very vulnerable.

Note :

 Remember that each queen starts on a square of her own color.

8|Page
 Remember that the square in the bottom right corner has to be white (from the perspective of
either player).
 Learn chess notation. Chess notation allows you to write down in a kind of "shorthand" both your
own and your opponent's moves, allowing you to study and re-create your game later.
 Learn chess tactics. Chess is an amazingly complex game. It has very few rules, but those rules
have given birth to whole books full of tactics and strategy. Read as many as you can to become
a better chess player.
 Know the values of chess pieces. Chess pieces are assigned values as a matter of convenience for
players trying to evaluate opportunities to give up a player in exchange for an opponent's player.
 Learn how to open in chess. The opening phase of a game lays the groundwork for the rest of the
game. Slip up here and you're likely to pay for it later. Openings are fun to study. An
experienced opponent will be aware of many opening patterns.

Software Requirement
Software : Visual Studio 2012, ASP.net with C# with any database

Documentation Requirement : MS Word 2010

4. Action plan

Sl. No. Topics Days needed


1. Review of Literature 7 days
2. Design of Chess Board 20 days
3. Placing the Chess pieces 5 days
4. Coding and Implementation 40 days
5. Testing 10 days

References :

[1] Murray, H.J.R. (1913). A History of Chess. Oxford University Press. pp. 782–784. ISBN 0-
19-827403-3.

[2] Hooper, David; Whyld, Kenneth (1984). The Oxford Companion to Chess. Oxford
University Press. p. 189. ISBN 0-19-217540-8.

[3] Susan Polgar, Special Chess Records (February 11, 2008). Retrieved on 2009-1-11.

9|Page
[4] "A collector of chess books and paraphernalia, he has the largest private chess library in the
world." David Hooper and Kenneth Whyld, The Oxford Companion to Chess (2nd ed. 1992), p.
358. ISBN 0-19-866164-9.

10 | P a g e

S-ar putea să vă placă și