Chess simulation. Click on the piece to move, and the location to move it to. If the action is legal, it will be taken. The game is done once a King enters checkmate, or once there is a draw.
- The Java version for this project is Java 11, which can be downloaded here
- Then, you can download the Chess.jar file and run it to start playing chess
There are six different pieces:
- Pawn
- Bishop
- Rook
- Knight
- Queen
- King
The pawn may move one square forward, or two squares forward on its first action, given that it does not move over any other pieces. The pawn may capture by moving one square diagonally forward.
The bishop may move or capture in any amount of squares diagonally, given that it does not move over any other pieces.
The rook may move or capture in any amount of squares horizontally or vertically, given that it does not move over any other pieces.
The knight may move one square vertically and two squares horizontally, or vice-versa. The knight may move over other pieces.
The queen may move or capture in any amount of squares horizontally or vertically or diagonally, given that it does not move over any other pieces.
The king may move to any square which is adjacent to it, given that it does not move into check.
There are three special actions:
- Pawn Promotion
- Castling
- En Passant
If a pawn reaches the other end of the board, the user may pick whether to promote it to a queen, rook, knight, or bishop.
If the rook and king have not yet moved, and there are no pieces between them, the king may move two squares towards the rook, and the rook may move to the adjacent square in which the king moved from, given that the king was not in check, will not move into check, and the path between where the king moved from and is moving to does not have any squares which are in check.
Immediately after a pawn moves two squares, a pawn may capture it as if it had only moved one square.
There are three special states:
- Check
- Checkmate
- Draw
The king is said to be in check when the next move by the opponent would capture it.
A checkmate occurs when the king is in check, and any action taken results in the king still being in check.
There are four ways for a draw to occur:
- Stalemate: occurs when the king is not in check, but any action taken results in the king being in check.
- 50 move rule: 50 moves from both white and black occur without any pawns moving or any pieces being captured.
- Threefold repetition: the same board repeats three times in a row, meaning the pieces are on the same squares, and the castling and en passant opportunities are the same.
- Insufficient mating material: not enough pieces to cause a checkmate, which can occur from a lone king against lone king, or king and knight, or king and bishop, or king and two knights.