1.2 KiB
1.2 KiB
Solitaire Chess Puzzle Generator
Goal: Generate 'hard' puzzles.
Install
- Install Rust from here.
- Run
cargo install --git https://github.com/cool-mist/sol_chess
to install the tool. - Run
sol_chess --help
to see the options.
Usage
- Generate a puzzle
$ sol_chess -g -n 6
Generated a puzzle with 6 pieces after 330 ms
PP..
..PB
.K..
.N..
- Solve a puzzle
$ sol_chess -- --solve PP....PB.K...N..
PP..
..PB
.K..
.N..
Found 1 solutions
1. Nb1 -> c3
2. Nc3 -> a4
3. Na4 -> b2
4. Nb2 -> d3
5. Nd3 -> b4
- Generate and solve a puzzle
$ sol_chess -g -n 6 --print
Generated a puzzle with 6 pieces after 933 ms
.P.N
B.R.
.K..
..N.
Found 1 solutions
1. Ba3 -> b4
2. Bb4 -> c3
3. Bc3 -> d4
4. Bd4 -> b2
5. Bb2 -> c1
Heuristics of current algorithm
- About 6-7 pieces on the board.
- Select pieces to place based on its weight. 3. Eg: Queen is too powerful, so it has lower weightage. 4. Eg: Knights are confusing. More knights.
- Discard puzzles with more than one solution.
Example puzzles generated
N...
P.B.
.R..
..KP
R...
..P.
..B.
.KNN
.PN.
P...
K..P
.R..
..PK
...R
P..P
B..N