A chess game builder with customizable rules and mechanics
Project description
Chess Builder
A custom chess variant in Pygame featuring:
- Gold Collection: Pawns can accumulate gold when it's your turn and your side is not in check.
- Piece Purchases: Spend gold to buy and place new pieces near your king.
- Promotion Choices: Pawns can promote with an interactive menu.
- Optional Time Controls: A built-in chess clock for timed games.
Features
-
Gold Accumulation
- When it's your turn and you're not in check, click a pawn you've already selected once to collect gold.
- Captured pieces add their accumulated gold to the capturing piece.
-
Purchases
- Kings can open a purchase overlay by clicking on them again (when it's your turn).
- Spend gold to place new pieces next to your king if it does not leave you in check.
- Each piece has a cost (Pawn=1, Knight=3, Bishop=3, Rook=5, Queen=9).
-
Promotion Menu
- When a pawn reaches the last rank, a promotion menu appears so you can choose a new piece.
-
Time Controls (Optional)
- A chess clock can be activated, with multiple standard time options.
- Each clock runs only during its respective turn.
-
Draw/Win Conditions
- Threefold repetition and the 50-move rule trigger draws.
- Standard checkmate/stalemate detection for wins/losses.
Installation
Option 1: Install from PyPI (Recommended)
pip install chess-builder
Option 2: Install from Source
-
Install Python (3.7+ recommended)
-
Clone the repository:
git clone https://github.com/badgkat/ChessBuilder.git cd ChessBuilder
-
Install dependencies:
pip install -r requirements.txt
Development Setup
If you want to contribute or modify the code:
-
Clone and install dev dependencies:
git clone https://github.com/YourUsername/ChessBuilder.git cd ChessBuilder pip install -r requirements-dev.txt
-
Install in editable mode:
pip install -e .
-
Run tests:
pytest
Running
Within the project directory, run:
python main.py
(or python3 main.py on some systems)
Usage
- Start New Game
Press New Game in the pause menu (hitEsc). You may be prompted to select a time control if you've enabled the chess clock. - Moving Pieces
Click a piece to see valid moves/captures. - Collecting Gold
If the currently moving side is not in check, and you have a pawn selected, click the same pawn again to collect gold. - Buying Pieces
Select your king, then click the king again to open the purchase overlay if you have enough gold. - Promotion
When a pawn reaches the last rank, a promotion menu appears so you can choose a new piece. - Pausing/Exiting
PressEscto toggle the pause menu or exit the game.
Controls
- Esc: Toggles the pause menu or closes overlays.
- C: Copies the move log to your clipboard.
- Mouse Wheel (over the right panel): Scrolls the move log.
Chess Clock (Optional)
- At game start, select a time format (e.g. "3|2") if time control is enabled.
- Each player's clock runs only during their turn.
- When you end your turn, any increment is added to the side that just moved.
Code Organization
board.py: Contains constants for the board (dimensions, colors), plus thePiececlass, and movement logic.clock.py(optional): Implements a chess clock with starting time, increment, and methods for updating.game.py: Holds the primaryGameclass, controlling board state, gold mechanics, promotions, overlays, and drawing calls.main.py: The main entry point with the game loop (main()).
To Do
- General UI beautifying.
- Adding Animations.
- Add an AI.
- Add non-local play.
Known Limitations
- No castling. As the king must move to build a rook there is no situation where castling would be possible.
- En Passsant logic only covers standard piece movement, not placed pawns.
Contributing
Pull requests and suggestions welcome! If you have ideas or new features, open an issue or submit a PR.
License
This project is licensed under the MIT License.
See the LICENSE file for details.
Enjoy building armies of gold-accumulating pieces and exploring this unique twist on classic chess!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chessbuilder-0.1.1.tar.gz.
File metadata
- Download URL: chessbuilder-0.1.1.tar.gz
- Upload date:
- Size: 39.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e737ec6b712d6a1d086eeb43be6d33c95c1d77cb1521ce5be43573b0c5e321ed
|
|
| MD5 |
07ba307cec1cd047e834ea0a814eda00
|
|
| BLAKE2b-256 |
ae6876e6f363b89e0631f624cacb27072bde1ceae12eee323ecdcd4e22dc4507
|
Provenance
The following attestation bundles were made for chessbuilder-0.1.1.tar.gz:
Publisher:
pypi-publish.yml on badgkat/ChessBuilder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chessbuilder-0.1.1.tar.gz -
Subject digest:
e737ec6b712d6a1d086eeb43be6d33c95c1d77cb1521ce5be43573b0c5e321ed - Sigstore transparency entry: 170337875
- Sigstore integration time:
-
Permalink:
badgkat/ChessBuilder@db82261ee7de39f9517107dbc127c787e2778d6c -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/badgkat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@db82261ee7de39f9517107dbc127c787e2778d6c -
Trigger Event:
release
-
Statement type:
File details
Details for the file chessbuilder-0.1.1-py3-none-any.whl.
File metadata
- Download URL: chessbuilder-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2498d7c540bce94840b9c44b37b0517ed04baff20440ea6435ef335945072a4
|
|
| MD5 |
e01b7314cbdb839f9fd591e1416d6bbc
|
|
| BLAKE2b-256 |
f9597a2960ef4238474c057160b2c52fe0fa931b63aa68b2131c5e0bb65cab4e
|
Provenance
The following attestation bundles were made for chessbuilder-0.1.1-py3-none-any.whl:
Publisher:
pypi-publish.yml on badgkat/ChessBuilder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chessbuilder-0.1.1-py3-none-any.whl -
Subject digest:
a2498d7c540bce94840b9c44b37b0517ed04baff20440ea6435ef335945072a4 - Sigstore transparency entry: 170337878
- Sigstore integration time:
-
Permalink:
badgkat/ChessBuilder@db82261ee7de39f9517107dbc127c787e2778d6c -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/badgkat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@db82261ee7de39f9517107dbc127c787e2778d6c -
Trigger Event:
release
-
Statement type: