A simple chess game built with Python and Pygame, using object-oriented programming principles.
This project is a 2-player chess game implementation focused on:
- Core chess mechanics
- OOP-based architecture
- Interactive graphical board using Pygame
It is a good learning project for understanding game loops, state management, and clean class design in Python.
- Standard 8x8 chessboard interface
- Turn-based gameplay
- Valid piece movement rules
- Check and checkmate detection
- Castling
- En passant
- Pawn promotion
- Object-oriented code structure
- Pygame-based rendering and input handling
- Language: Python
- Library: Pygame
- Programming style: Object-Oriented Programming (OOP)
git clone https://github.com/rituuu001/Chess.git
cd ChessWindows (PowerShell):
python -m venv venv
venv\Scripts\activatemacOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install pygamepython main.py- Start the game window.
- Players take turns moving pieces.
- The game enforces chess rules, including special moves and check/checkmate conditions.
Chess/
├── assets/ # Images
├── board.py
├── game.py
├── gui.py #GUI
└── README.md
Typical class responsibilities in this project:
Game: controls game loop and game stateBoard: manages board state and piece positionsPiecebase class: shared behavior for all pieces- Piece subclasses (
Pawn,Rook,Knight, etc.): movement logic and rules
- AI opponent
- Move history and undo move support