Pawnfuddle – High-Precision Chess960 (Fischer Random) Generator
Pawnfuddle is a lightweight CLI tool that generates valid Chess960 starting positions using the official Scharnagl's Algorithm. It maps every possible position to a unique ID (0-959), ensuring mathematical determinism and compatibility with international tournament standards.
- Scharnagl’s Algorithm: Direct mapping of IDs (0-959) to positions. No more "shuffling and praying" for valid bishops.
- Deterministic Generation: Generate specific positions via
--idfor tournaments or study. - Engine Ready: Full FEN string output compatible with Stockfish and modern chess GUIs.
- Terminal Optimized: Clean ASCII board visualization with "Flip" support for black-side perspective.
- Zero Dependencies: Pure Python 3. Works on Linux, BSD, and macOS out of the box.
- Clone the repository:
git clone [https://github.com/Cyber-idea12/Pawnfuddle.git](https://github.com/Cyber-idea12/Pawnfuddle.git)
cd Pawnfuddle- Run directly:
python3 pawnfuddle.py [flags]python3 pawnfuddle.pyExample: ID 518 is the classical chess starting position.
python3 pawnfuddle.py --id 518python3 pawnfuddle.py --count 5python3 pawnfuddle.py --fenpython3 pawnfuddle.py --seed 1800 --count 3| Flag | Type | Description |
|---|---|---|
--id ID |
int | Fetch a specific position (0-959). |
--count N |
int | Number of positions to generate (default=1). |
--fen |
bool | Print FEN only, skip ASCII board. |
--ascii |
bool | Force ASCII board print (default if --fen not used). |
--seed S |
int | Random seed for reproducible random IDs. |
--flip |
bool | Flip board (Perspective from the Black side). |
--- Chess960 Position ID: 214 ---
b n n q r k r b
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
B N N Q R K R B
ID = 214
bnnqrkrb/pppppppp/8/8/8/8/PPPPPPPP/BNNQRKRB w KQkq - 0 1
Pawnfuddle ensures the two core rules of Chess960 are always met:
- Bishops must be on opposite-colored squares.
- The King must be placed on a square between the two Rooks to allow for legal castling.
This project is licensed under the MIT License.