The JavaScript Chessboard
Did you ever wish you had a chessboard on your computer with pieces that you could move?
Now you do!
Drag the pieces to move them. Go backward or forward by pressing “move back” or “move forward.”
The move history saves certain move sequences as one move.
• Move captured pieces off the board immediately after capture.
• Exchange the pawn for its replacement immediately after pawn promotion.
• To castle, move the king first, then the rook.
While a move sequence is in progress, it will be indicated after the move number.
The move history ignores non-moves and rearranging pieces off the board. Use the “move back” function to undo erroneous moves.
Check “board setup” to stop recording history while setting up a board position. Then use “reset history,” and “b/w” to change color, if needed.
(Remember to uncheck “board setup”!)
The extra pieces are for pawn promotion.
Moves are recorded as reversible algebraic notation in the text area on the left, and Forsyth–Edwards notation in the string below the controls: the piece positions in rows, with numbers indicating blank spaces; which color to move; castling ability; en passant target, if any; half-moves since the last capture or pawn move; and the move number.
To play Chess960 (Fischer Random Chess), press “generate” to randomly set up a position. Or, arrange the white pieces and press “read.” The setup procedure:
• Place the bishops on different colors.
• Place the queen and knights anywhere.
• Place the king between the rooks.
The Forsyth–Edwards notation is modified in Chess960 to Shredder-FEN: to resolve ambiguity, castling ability is indicated by the files of the rooks rather than “K” and “Q.” Also, as in X-FEN, only “real” en passant targets, with an enemy pawn in position, are recorded.
• In Chess960, castling may require moving only the king, or moving it to the square occupied by the rook. In these cases, begin the move sequence by moving the king to the spot off the board beside its target square.
You may use the “load FEN string” field to load a saved chess position. The script error-checks the piece placement part of the string; and if present, the overall structure (but not all the details) of the rest. Because there is no move history, the move count resets to 1.
Wikipedia on Forsyth–Edwards Notation:
A FEN record contains six fields. The separator between fields is a space. The fields are:
FEN is critical for recording games in chess variants such as Chess960 (also known as Fischer Random Chess), where the initial position is not necessarily the traditional initial position. However, the FEN castling availability encoding (KQkq) is inadequate for positions in which there are two Rooks on the same side of the King on the back rank. It is ambiguous which Rook is still available for castling without knowing their initial positions.
The solution implemented by chess engines like Shredder and Fritz_9 is to use the letters of the columns on which the rooks began the game. This scheme is sometimes called Shredder-FEN. For the traditional setup, Shredder-FEN would use AHah instead of KQkq.
Castling in Chess960: An appeal for simplicity by John Kipling Lewis