| pieces | ||
| .gitignore | ||
| board.py | ||
| main.py | ||
| position.py | ||
| readme.md | ||
| renderPieces.py | ||
Chess Game
A Python chess board renderer built with Pygame. Renders a classic 8x8 chessboard with alternating black and white squares at 60 FPS.
Requirements
- Python 3.x
- Pygame
Confirmed working on: Arch Linux (omarchy), Windows 11
Installation
Python needs to be installed.
Then install Pygame by running this in your terminal:
pip install pygame
If you're on Linux and pip doesn't work, try pip3 instead. On Arch you can also install it through pacman:
sudo pacman -S python-pygame
Once that's done, just run the game with:
python main.py
How It Works
The six chess piece types are defined as named variables at the top of main.py, and two lists represent the standard starting rows — the back rank and the pawn row.
The board itself is an 800x800 window split into a 8x8 grid of 100x100 pixel squares. Each row alternates which color starts first, giving you the classic chessboard pattern. The whole board is redrawn every frame, capped at 60 FPS using Pygame's clock.
The main loop handles three things: listening for the quit event, clearing and redrawing the board each frame, and flipping the display buffer to show the result.
Project Structure
chess-game/
└── pieces
└── pieces.png (multiple)
├── board.py
├── main.py
└── README.md