A fully-featured chess game built with Python and Pygame.
- Two game modes — Player vs Player (same screen) or Player vs Bot
- Strong AI — Minimax algorithm with alpha-beta pruning (depth 3), piece-square tables for positional evaluation, and MVV-LVA move ordering
- Smooth animations — Piece movement with smoothstep easing
- Procedural sounds — Move, capture, check, castle, and game-end sounds generated at runtime (no audio files needed)
- Drag & drop — Pick up and drop pieces with the mouse; click-to-move also works
- Full chess rules — Castling, en passant, pawn promotion, check/checkmate/stalemate detection
- Captured pieces bar — Displays taken pieces and material advantage for each side
- Check highlighting — King square turns red when in check; status bar tints red
- Turn indicator — Colored circle + board-edge accent line showing whose turn it is
- Fullscreen support — Letterboxed scaling for any resolution
- Promotion dialog — Choose queen, rook, bishop, or knight on pawn promotion
- Python 3.10+
- pygame 2.x
pip install pygame
python main.py
Make sure the images_chess/ folder is in the same directory as main.py.
| Key / Action | Description |
|---|---|
| Click piece | Select and show legal moves |
| Click target square | Move selected piece |
| Drag & drop | Pick up a piece and drop it on a target square |
| R | Restart game |
| F11 | Toggle fullscreen |
| ESC | Return to main menu / quit |
ChessGame/
├── main.py # Game loop, rendering, input handling
├── utils.py # Board logic, move generation, AI
└── images_chess/ # Piece sprites (PNG, 60x60)
The bot plays as Black and uses:
- Minimax with alpha-beta pruning at depth 3
- Piece-square tables for all 6 piece types (positional scoring)
- MVV-LVA move ordering (captures examined first, ranked by victim/attacker value)
- Material evaluation using standard piece values (P=100, N=320, B=330, R=500, Q=900)