A beautiful, feature-rich chess game built with Python and Pygame. Play against a friend with an elegant interface, multiple board themes, sound effects, and smooth gameplay!
Features β’ Installation β’ How to Play β’ Customization β’ Contributing
![]() |
![]() |
| Menu | Board & Pieces |
Watch the magic happen - click any piece and see all legal moves instantly highlighted!
![]() |
![]() |
| Standard Board | Legal Moves Highlighted |
Customize your playing experience with three beautiful themes:
![]() |
![]() |
![]() |
| Classic Brown | Forest Green | Ocean Blue |
| Feature | Description |
|---|---|
| Full Chess Rules | Complete implementation including castling, en passant, pawn promotion |
| Legal Move Detection | Automatic highlighting of all legal moves for selected piece |
| Check & Checkmate | Proper detection with special sound effects |
| Stalemate Detection | Automatic draw detection when no legal moves available |
| Move Validation | Prevents illegal moves, including those that expose the king |
| Feature | Description |
|---|---|
| 3 Board Themes | Choose between Brown, Green, and Blue color schemes |
| Move Highlighting | Selected pieces and legal moves clearly highlighted |
| Professional UI | Modern menu system with smooth animations |
| Responsive Design | Clean 800x800 game board with intuitive controls |
| Feature | Description |
|---|---|
| Sound Effects | Unique sounds for moves, captures, checks, checkmate, castling |
| Sound Toggle | Easily enable/disable sounds with top-left button |
| Game Start Music | Welcome audio when starting a new game |
| Mode | Status |
|---|---|
| Player vs Player Fully implemented | |
| Player vs AI | Coming soon! (Contribute your AI!) |
- Python 3.7 or higher
- Pygame library
# Clone the repository
git clone https://github.com/mathisdelsart/CheckAndCrown.git
cd CheckAndCrown
# Install dependencies
pip install -r requirements.txt
# Run the game
python main.pyThat's it! The game will launch and you're ready to play!
- Launch the game by running
python main.py - You'll see a main menu with two options:
- Player vs Player: Play against a friend on the same computer
- Player vs AI: Play against the computer (coming soon!)
- Click your preferred mode to start
| Control | Function |
|---|---|
| Sound Button | Toggle sound effects on/off (top-left corner) |
| Theme Button | Cycle through Brown β Green β Blue themes (top-right corner) |
| Mouse Click | Select menu options and interact with pieces |
-
Select a Piece
- Click on any of your pieces (white starts first)
- Legal moves will be highlighted in a lighter shade
-
Make a Move
- Click on a highlighted square to move there
- Click the same piece again or another piece to cancel
-
Special Moves
- Castling: Click your king and then click two squares toward the rook
- En Passant: Automatically detected when capturing a pawn diagonally
- Pawn Promotion: Automatically promotes to Queen when reaching the end
-
Game End
- Checkmate: The game announces the winner!
- Stalemate: Declared when no legal moves but not in check
- A menu appears with options to replay or return to main menu
| Key/Action | Function |
|---|---|
| Left Click | Select piece / Make move |
| Sound Button | Toggle sounds on/off |
| Theme Button | Change board color theme |
| ESC | Quit game (during gameplay) |
Python-Chess/
βββ main.py # Game entry point
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ assets/
β βββ music/ # Sound effects (.wav files)
β βββ pieces/ # Chess piece images
β βββ screenshots/ # Game screenshots for README
βββ src/
βββ piece.py # Piece classes and movement logic (686 lines)
βββ game_state.py # Game state management
βββ game.py # Main game loop and event handling
βββ board.py # Board rendering
βββ menu.py # Menu system (main + end game)
βββ button.py # UI button components
βββ assets.py # Asset loading
βββ configs.py # Game constants and colors
βββ player_ai.py # AI placeholder (contribute here!)
You can easily customize the game by modifying src/configs.py:
SIZE_SQUARE = 100 # Size of each square in pixels (default: 100)
ROW = 8 # Number of rows (standard chess)
COL = 8 # Number of columns (standard chess)Add your own theme to COLORS_BOARD:
COLORS_BOARD = [
[(240, 217, 181), (181, 136, 99)], # Brown theme
[(238, 238, 210), (118, 150, 86)], # Green theme
[(222, 227, 230), (140, 162, 173)], # Blue theme
# Add your custom theme here!
[(your_light_color), (your_dark_color)]
]COLOR_POSSIBLE_MOVES_LIGHT = (186, 202, 43) # Light square moves
COLOR_POSSIBLE_MOVES_DARK = (186, 202, 43) # Dark square movesContributions are welcome! Here are some ideas to get you started:
We need your help to create a chess AI!
The file src/player_ai.py contains a placeholder AI that currently makes random legal moves. This is your chance to implement a real chess engine!
-
Start Simple - Improve the random AI:
- Add piece value scoring (Pawn=1, Knight=3, Bishop=3, Rook=5, Queen=9)
- Prefer captures over normal moves
- Avoid moves that lose material
-
Implement Minimax Algorithm:
- Recursively search future positions (3-5 moves deep)
- Evaluate positions using material + positional bonuses
- Choose the move with the best outcome
-
Add Alpha-Beta Pruning:
- Optimize minimax to skip unnecessary branches
- Doubles your search depth!
-
Position Evaluation:
- Material: Count piece values
- Position: Reward center control, piece development
- King Safety: Penalize exposed kings
- Pawn Structure: Evaluate doubled/passed pawns
-
Advanced Features:
- Opening book (pre-stored opening moves)
- Endgame tablebases
- Iterative deepening
- Transposition tables
The player_ai.py file includes detailed comments and example code structure to guide you!
- Chess Programming Wiki - Comprehensive resource
- Minimax Algorithm - Core algorithm
- Alpha-Beta Pruning - Optimization technique
- Time Control: Add chess clocks for timed games
- Move History: Display notation of moves played
- Undo/Redo: Let players take back moves
- Save/Load Games: Store games in PGN format
- Online Multiplayer: Play against friends remotely
- Different Piece Sets: Add alternative piece designs
- Animated Moves: Smooth piece movement animations
- Analysis Mode: Show position evaluation and best moves
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-ai) - Commit your changes (
git commit -m 'Add amazing chess AI') - Push to the branch (
git push origin feature/amazing-ai) - Open a Pull Request
This project is open source and available for educational purposes.
Mathis DELSART
- GitHub: @mathisdelsart
Checkmate your way to victory! βοΈπ





