A Pygame-based chess game that adds a “quantum-lite” layer on top of standard chess rules: pieces can split into two destinations, the game can maintain multiple classical branches at once, and some events behave like probabilistic measurement/collapse.
This project uses:
- python-chess for classical legality (legal moves, check rules, castling, en passant, promotion)
- Pygame for UI and input
- CairoSVG to render SVG boards/pieces into Pygame surfaces
- Standard chess rules enforced by python-chess (move legality, checks, etc.)
- “Quantum-lite” state represented as a set of board branches
- Split move: create a superposition of two quiet moves (UI-assisted)
- Basic branch merging (identical positions) and pruning (branch limit)
- Simple bot (random legal move selection, sometimes attempts split)
- UI hints, move log, game-over overlay
python -m venv .venv
.\.venv\Scripts\Activate.ps1python3 -m venv .venv
source .venv/bin/activatepip install -U pip
pip install pygame cairosvg chess pillowpip install -r requirements.txtNote: if your
requirements.txtis saved as UTF-16 andpipfails to read it, convert it to UTF-8 first (macOS/Linux):
iconv -f utf-16 -t utf-8 requirements.txt > requirements.utf8.txt
pip install -r requirements.utf8.txtFrom the repository root:
python main.pyA window titled “Quantum Lite Chess” should appear.
- Press W to play as White
- Press B to play as Black
- Click one of your pieces to select
- Click a highlighted square to make a normal move
- Press Q to toggle Quantum Mode ON/OFF
- Quantum split move (when Quantum Mode is ON):
- Select your piece
- Hold SHIFT and click an empty highlighted square to set Target A
- Click a different highlighted square to set Target B
- Press ESC:
- If game is over: return to menu
- If game is running: cancel selection / cancel split Target A
Internally, the game maintains multiple classical boards (“branches”) at once. A move can:
- Apply to all branches (when legal),
- Apply only to some branches (others may become “null moves”),
- Trigger measurement-like collapse for special cases (e.g., capture/no-capture outcomes),
- Merge branches when they become identical again.
This is intentionally “lite”: it aims to be playable and easy to reason about, not a physically rigorous model.
.
├─ main.py # Entry point
├─ app/
│ ├─ game.py # Main loop, input handling, menus
│ ├─ assets.py # Asset loading (SVG -> PNG via CairoSVG)
│ └─ config.py # Screen/board config + asset paths
├─ render/
│ └─ renderer.py # Drawing board, pieces, HUD, highlights
├─ quantum/
│ └─ quantum_board.py # Quantum-lite engine (branches + amplitudes)
├─ qlc/
│ ├─ board.py # Legacy weighted-branch board implementation
│ ├─ rules.py # Move generation helpers
│ └─ piece.py # Piece representation used by renderer
├─ ai/
│ └─ bot.py # Simple bot logic
├─ assets/
│ ├─ boards/ # SVG boards
│ └─ p1/ # Piece SVGs + background images
└─ requirements.txt
app/config.py currently uses Windows-style paths (for example assets\p1).
On macOS/Linux, these may not resolve correctly. Prefer using os.path.join(...) or forward slashes.
If you see errors like:
OSError: no library called "cairo" was found
It usually means the Cairo system library is missing. Install Cairo for your OS, then retry.
- Confirm files exist under
assets/p1/ - Check the asset paths in
app/config.py(especially on macOS/Linux) - Ensure
cairosvgcan load SVGs (see Cairo dependency note above)
This project expects python-chess (import name: chess).
If your environment also has a different package that provides chess, remove it and reinstall the correct one.
