expanded and refactored readme.md

This commit is contained in:
milanjaeckel 2026-05-10 21:26:02 +02:00
parent e9d0804bfc
commit aa1e50510c

View File

@ -1,18 +1,54 @@
__"Chess game"__
# Chess Game
__---SOURCES---__
A Python chess board renderer built with Pygame. Renders a classic 8x8 chessboard with alternating black and white squares at 60 FPS.
https://www.pygame.org/docs/tut/ImportInit.html
## Requirements
https://www.geeksforgeeks.org/python/how-to-draw-rectangle-in-pygame/
- Python 3.x
- Pygame
https://blender.stackexchange.com/questions/23040/how-to-easily-toggle-a-boolean-property
**Confirmed working on:** Arch Linux (omarchy), Windows 11
## Installation
__---Confirmed working systems---__
First, make sure you have Python installed. You can grab it at [python.org](https://www.python.org/downloads/) if not.
Linux:
Then install Pygame by running this in your terminal:
Arch (omarchy)
```bash
pip install pygame
```
Windows 11
If you're on Linux and `pip` doesn't work, try `pip3` instead. On Arch you can also install it through pacman:
```bash
sudo pacman -S python-pygame
```
Once that's done, just run the game with:
```bash
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/
├── main.py
└── README.md
```
## Sources
- [Pygame — Import and Initialization](https://www.pygame.org/docs/tut/ImportInit.html)
- [GeeksforGeeks — How to Draw a Rectangle in Pygame](https://www.geeksforgeeks.org/python/how-to-draw-rectangle-in-pygame/)
- [Blender Stack Exchange — Toggle a Boolean Property](https://blender.stackexchange.com/questions/23040/how-to-easily-toggle-a-boolean-property)