2025-01-05 18:52:44 +05:30
2025-01-05 00:31:15 +05:30
2025-01-04 16:24:38 +05:30
2025-01-05 00:23:38 +05:30
2025-01-05 18:52:44 +05:30
2025-01-04 16:18:49 +05:30
2025-01-05 00:28:02 +05:30

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

  1. About 6-7 pieces on the board.
  2. 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.
  3. 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
Description
Solitaire chess solver and puzzle generator implemented in rust
Readme AGPL-3.0 661 KiB
Languages
Rust 94.8%
Shell 4.1%
HTML 1.1%