Construct Chess

608K+ views
The following text is extracted from Wikipedia, under Creative Commons Attribution-ShareAlike 3.0 License. For more details and references, please access the original article. Chess is a two player game on a chessboard, with sixteen pieces (of six types) for each player. Each type of chesspiece moves in a unique way. The goal of the game is to checkmate the opponent’s king with inevitable capture. In addition to winning, there are several ways that a game can end in a draw.

Rules

The player controlling the white army is named “White” and the the player controlling the black pieces is named “Black”. White begins first and the players alternate moves after that. A move has to be made every turn, skipping isn’t allowed. Not even when having to move means losing. A game continues until a king is checkmated, a player resigns, or a draw is declared.

Movement

Each chess piece has its own method of movement. Moves are made to vacant squares except when capturing an opponent’s piece. With the exception of any movement of the knight and the occasional castling maneuver, pieces cannot jump over each other. When a piece is captured, the attacking piece replaces the enemy piece on its square (en passant being the only exception). The captured piece is then removed from the game and may not be returned to play for the remainder of the game. The king can be put in check, but cannot be captured (see below). King The king can move exactly one square either horizontally, vertically, or diagonally. Only once per player, per game, is a king allowed to make a special move known as castling (see below). Rooks The rook moves any number of vacant squares vertically or horizontally. It also is moved while castling. Bishops The bishop moves any number of vacant squares in any diagonal direction. Queen The queen can move any number of vacant squares either diagonally, horizontally or vertically. Knights The knight moves to the nearest square not on the same rank, file, or diagonal. In other words, the knight moves two squares horizontally then one square vertically, or one square horizontally then two squares vertically. Its move is not blocked by other pieces, it basically jumps to the new location. Pawns Pawns have the most complex rules of movement:
  • If the square infront of a pawn is unocccupied, the pawn can move forward one square. If it has not yet moved, each pawn has the option of moving two squares forward, given both squares in front of the pawn are unoccupied. A pawn cannot move backwards.
  • Pawns are the only pieces that capture differently from how they move. They can capture an enemy piece on either of the two spaces adjacent to the space in front of them (i.e., the two squares diagonally in front of them) but cannot move to these spaces if they are vacant.
The pawn is also involved in the two special moves en passant and promotion. Castling Castling consists of moving the king two squares towards a rook, then placing the rook on the other side of the king, adjacent to it. Castling is only allowed if all of the following conditions are met:
  • The king and rook involved in castling have not previously moved
  • There are no pieces between the king and the rook
  • The king currently isn’t in check, and isn’t going to be passing through or ending up in a square that is under attack by an enemy piece (though the rook is permitted to be under attack and can pass over an attacked square)
En passant If player A’s pawn moves forward two squares and player B has a pawn on its fifth rank on an adjacent file, B’s pawn can capture A’s pawn as if A’s pawn had only moved one square. This capture can only be made on the immediately subsequent move. For example: if the white pawn moves from a2 to a4, the black pawn on b4 can capture it en passant, ending up on a3. Pawn promotion If a pawn advances to its eighth rank, it is then promoted to a queen of the same color.

Check

A king is in check when it is under attack by one or more enemy pieces. A piece unable to move because it would place its own king in check may still deliver check to the opposing player. A player may not make any move which places or leaves his king in check. The possible ways to get out of check are:
  • Moving the king to a square where it is not threatened.
  • Capture the threatening piece (possibly with the king).
  • Block the check by placing a piece between the king and the opponent’s threatening piece.

End of the game

Checkmate

If a player’s king is placed in check and there is no legal move that the player can make to escape check, then the king is said to be checkmated. This ends the game ends and the player loses. Unlike other pieces, the king is never actually captured or removed from the board because the checkmate ends the game.

Draws

The game ends in a draw if any of these conditions occur:
  • The game is automatically ends in a draw if the moving player is not in check and has no legal move. This situation is called a stalemate.
  • The game is immediately drawn when there is no possibility of checkmate for either side with any series of legal moves. This draw is often due to insufficient pieces during the endgame: king against king, king against king and bishop, king against king and knight or king and bishop against king and bishop, with both bishops on diagonals of the same color.
  • Both players agree to a draw after one of the players makes such an offer.

Credits

Development: Florian Isikci (@ChisiVR) Project originally based on Chess project by schowdhuri.