Chess is a two player strategy game played on a 64 x 64 square chessboard, with the goal of capturing the opponent's king. Although this may seem simple, the underlying rules and strategies make chess a very complex game.
- 1 or 2 squares forward on the first move
- 1 square forward on every other move
- Captures diagonally forwards
- Moves horizontally or vertical
- Moves along the two diagonals
- Moves in a L shape 2 squares in 1 direction and 1 square in a perpendicular direction
- Moves horizontally, vertically or diagonally
- Moves one square either horizontally, vertically or diagonally
Rook, Queen, Pawn, and Bishop moves require there to be no pieces in the way Iterate through all the cells between fromCell and toCell and if a piece exists, the move is not possible.
Pins and Discovered checks pose a huge problem in detecting checks. create an isCheck() function to detect if the board is in a checked state, and also create a causesCheck() function to see if the particular move causes the board state to be in check. causesCheck() would move the piece, store the state, move back the piece, then return the state.
- Create any directory on your computer
- Download the 3 program files: index.html, Chess.css, Chess.js and place them in the directory
- Download all the png images in Chess Pieces, and create a directory called Chess Pieces within the previously created one and store all the images there
- Find the index.html file on your computer and right click and open it with a browser such as Chrome