Add as command line tool

This commit is contained in:
cool-mist
2025-01-05 00:23:38 +05:30
parent 354b59c004
commit be9585d5c2
7 changed files with 224 additions and 15 deletions
+54
View File
@@ -2,6 +2,60 @@
Goal: Generate 'hard' puzzles.
## Install
- Install Rust from [here](https://www.rust-lang.org/tools/install).
- 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
```bash
$ sol_chess -g -n 6
Generated a puzzle with 6 pieces after 330 ms
PP..
..PB
.K..
.N..
```
- Solve a puzzle
```bash
$ 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
```bash
$ 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.