This project is a simple implementation of a mini chess game using Python and Pygame.
-
Ensure you have Python installed on your system. You can download it from python.org.
-
Install Pygame by running the following command in your terminal:
pip install pygame
-
Clone or download this repository to your local machine.
To run the game, navigate to the project directory in your terminal and run:
python main.py
or
python main3.py
main.py
: The main script that runs the game loop and handles events. Implements point-and-click chess gameplay with AI support.main2.py
: Old backup implementation of the main game with drag-and-drop functionality.main3.py
: Current active version with drag-and-drop functionality, functionally same asmain.py
.
chessboard.py
: Contains theChessBoard
class for rendering the chessboard, managing piece positions, and handling board-related operations.game_rules.py
: Implements theGameRules
class that manages game logic, move validation, and game state checks.chess_ai.py
: Contains theChessAI
class implementing minimax algorithm with alpha-beta pruning for AI opponents.
piece.py
: Original implementation of chess pieces with basic movement logic.piece2.py
: Refactored version with improved movement validation and cleaner inheritance structure.
ui/start_menu.py
: Implements theStartMenu
class for game mode selection and initial setup.ui/game_menu.py
: Contains theGameMenu
class for in-game menu options (save/load/exit).ui/status_display.py
: Manages theStatusDisplay
class for showing game state, moves, and notifications.
sounds.py
: Contains theSoundManager
class for handling game audio effects.sounds/
: Directory containing audio files:move.wav
: Sound effect for piece movementcheck.wav
: Sound effect for check statecheckmate.wav
: Sound effect for checkmate
Pieces/
: Directory containing chess piece imagesChessPiecesArray.png
: Sprite sheet containing all chess piece images
saved_game.pkl
: Binary file storing saved game states (auto-generated when saving)
-
.gitignore
: Specifies which files Git should ignore -
Important Note: When switching between
piece.py
andpiece2.py
, make sure to update the import statement inchessboard.py
accordingly.
This project currently only renders the chessboard and has a simple turn-based gameplay loop. Future improvements could include:
- Comparison between algorithms implemented above
- Minor refactoring and performance improvements
Feel free to contribute to this project and expand its functionality!
For more information about Pygame and its functions, refer to the official Pygame documentation: