Yo, welcome to this epic Chess Game built with Python and Pygame! Itโs a fully functional chess experience with slick visuals, sound effects, timers, and all the classic chess rules โ from castling to en passant to pawn promotions. Whether you're a chess grandmaster or just here for the vibes, this gameโs got you covered. ๐
- โ๏ธ Classic Chess Gameplay โ Full support for standard chess rules.
- โฑ๏ธ 10-Minute Timers โ Both players get 10 minutes; time runs only on your turn. Lose on time!
- ๐ผ๏ธ Visual Vibes โ Clean 8ร8 board with alternating squares and a stylish captured-pieces display.
- ๐ Sound Effects โ Custom sounds for moves, captures, checks, checkmates, castling, and more.
- ๐ Pawn Promotion โ Promote to a queen, rook, bishop, or knight when reaching the last rank.
- ๐ณ๏ธ En Passant โ Yes, the spicy pawn capture is implemented!
- ๐ฐ Castling โ Both kingside and queenside castling are supported.
- ๐ Checkmate & Stalemate Detection โ Endgame logic with victory messages and screen dimming.
- ๐ Restart Option โ Press
Rto reset the board and play again after the game ends. - ๐ Auto-Flipping Board โ The board flips after every move to show the active playerโs perspective.
- ๐ PGN Export โ Save your game history in PGN format after each match. Perfect for analysis or bragging rights.
- ๐ FEN Support โ Load any chess position from ForsythโEdwards Notation (FEN).
git clone https://github.com/Rayan581/Chess.git
cd chess-gameMake sure you have Python 3.x and Pygame installed:
pip install pygameEnsure the following structure is present under the assets/ folder:
assets/
โโโ pieces/
โ โโโ black/
โ โ โโโ black-pawn.png
โ โ โโโ black-knight.png
โ โ โโโ ...
โ โโโ white/
โ โโโ white-pawn.png
โ โโโ white-knight.png
โ โโโ ...
โโโ sounds/
โโโ move.mp3
โโโ capture.mp3
โโโ check.mp3
โโโ checkmate.mp3
โโโ ...
If not included, you can grab free chess piece PNGs and sound effects online.
python main.py- Move Pieces: Click a piece to select it. Valid moves will be highlighted. Click again to move.
- 10-Minute Timer: Both players start with 10 minutes. The clock runs only during your turn. Time out = loss.
- Pawn Promotion: Reach the last rank and choose from queen, rook, bishop, or knight.
- Restart: After the game ends, press
Rto reset and start fresh. - Quit: Press
ESCor close the window to exit. - View Flip: The board flips after each turn for an immersive perspective shift.
After the game ends (via checkmate, stalemate, or timeout), the game automatically generates a .pgn file in the games folder inside the project folder.
You can:
- Open it in tools like lichess.org or chess.com/analysis
- Replay moves, review blunders, or save your finest victories
Each PGN includes:
- Player names
- Result (win/loss/draw)
- Termination reason (checkmate, timeout, etc.)
- Full move history in official notation
PGN file example:
game_2025-07-15_19-34-22.pgn
You can start from any position using a FEN string! Perfect for studying openings, recreating famous games, or resuming saved positions.
Example FEN strings:
-
Starting position:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 -
After
1. e4 e5 2. Nf3 Nc6:r1bqkbnr/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3
To use it, just update the board setup in main.py with your FEN string, and the game will load from that position.
chess-game/
โโโ main.py # Game loop, input, and timer logic
โโโ classes/
โ โโโ board.py # Chess board state, rendering, and game rules
โ โโโ piece.py # Piece class and movement logic
โ โโโ sound_manager.py # Plays sound effects
โโโ assets/ # Piece images and sound files
โโโ games/ # PGNS of previously played games
Wanna make this game even more lit? Fork the repo, make your changes, and submit a pull request! ๐ก
Ideas:
- Add a single-player mode with AI
- Move history or undo functionality
- Add increment-style clocks (e.g. +2 seconds per move)
- Animations, themes, and visual polish
- LAN or online multiplayer
This project is licensed under the MIT License. Feel free to use, modify, and share โ just be chill and give credit where itโs due. โ๏ธ
Made with โค๏ธ, caffeine, and dramatic blunders.