Rules of play for chess

Chess is a two-player board game utilizing a chessboard and sixteen pieces of six types for each player. Each type of piece moves in a distinct way. The goal of the game is to checkmate (threaten with unescapable capture) the opponent’s king. Games do not necessarily end with checkmate; players often resign if they believe they will lose. A game can also end in a draw in several ways.
Basic Rules
The player controlling the white pieces is named “White”; the player controlling the black pieces is named “Black”. White moves first, then players alternate moves. Making a move is required; it is not legal to skip a move, even when having to move is detrimental. Play continues until a king is checkmated, a player resigns, or a draw is declared.
Movement of figures
A knight moves to the nearest square not on the same rank, file, or diagonal. (This can be thought of as moving two squares horizontally then one square vertically, or moving one square horizontally then two squares vertically—i.e. in an “L” pattern.) The knight is not blocked by other pieces: it jumps to the new location.
A bishop moves any number of vacant squares in any diagonal direction.
A rook moves any number of vacant squares in a horizontal or vertical direction. It also is moved when castling.
The queen moves any number of vacant squares in a horizontal, vertical, or diagonal direction.
Pawns have the most complex rules of movement:
A pawn moves straight forward one square, if that square is vacant. If it has not yet moved, a pawn also has the option of moving two squares straight forward, provided both squares are vacant. Pawns cannot move backwards.
Pawns are the only pieces that capture differently from how they move. A pawn can capture an enemy piece on either of the two squares diagonally in front of the pawn (but cannot move to those squares if they are vacant).
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.
If a player advances a pawn to its eighth rank, the pawn is then promoted (converted) to a queen, rook, bishop, or knight of the same color at the choice of the player (a queen is usually chosen).
The king moves exactly one square horizontally, vertically, or diagonally. A special move with the king known as castling is allowed only once per player, per game (see below).
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 permissible if all of the following conditions hold:
- The king and rook involved in castling must not have previously moved
- There must be no pieces between the king and the rook
- The king may not currently be in check, nor may the king pass through or end up in a square that is under attack by an enemy piece (though the rook is permitted to be under attack and to pass over an attacked square)
- The king and the rook must be on the same rank
Evaluation of the game
The game is won if:
- the opponent surrenders
- the opposing king is checkmated