How to Play Chess Master AI
You play as White against an AI opponent (Black). Click any white piece to select it — valid destination squares will highlight in green. Click a highlighted square to move. The AI uses minimax search with alpha-beta pruning at depth 3 for challenging but beatable play.
Chess Piece Moves
- ♙ Pawn: Moves forward 1 square (or 2 from start). Captures diagonally. Promotes on the last rank.
- ♘ Knight: Moves in an L-shape (2+1 squares). Can jump over pieces.
- ♗ Bishop: Moves diagonally any number of squares.
- ♖ Rook: Moves horizontally or vertically any number of squares.
- ♕ Queen: Combines rook and bishop movement.
- ♔ King: Moves 1 square in any direction. Can castle with a rook.
Special Rules
- Castling: King and rook swap if neither has moved and no pieces are between them.
- En Passant: A pawn can capture a pawn that just moved 2 squares past it.
- Promotion: When a pawn reaches the last rank, choose Queen, Rook, Bishop, or Knight.
- Checkmate: Your king is in check with no legal moves — you lose.
- Stalemate: No legal moves but not in check — it's a draw.
Controls
- New Game: Resets the board to starting position.
- Undo Move: Takes back your last move and the AI's response (available on your turn).
