multi-puzzle-solver 0.8.7__tar.gz → 0.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/PKG-INFO +117 -37
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/README.md +117 -37
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/multi_puzzle_solver.egg-info/PKG-INFO +117 -37
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/multi_puzzle_solver.egg-info/SOURCES.txt +4 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/__init__.py +3 -1
- multi_puzzle_solver-0.9.0/src/puzzle_solver/puzzles/chess_range/chess_melee.py +7 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/chess_range/chess_range.py +169 -30
- multi_puzzle_solver-0.9.0/src/puzzle_solver/puzzles/chess_range/chess_solo.py +9 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/inertia/parse_map/parse_map.py +8 -8
- multi_puzzle_solver-0.9.0/tests/test_chess_melee.py +37 -0
- multi_puzzle_solver-0.9.0/tests/test_chess_range.py +33 -0
- multi_puzzle_solver-0.9.0/tests/test_chess_solo.py +23 -0
- multi_puzzle_solver-0.8.7/tests/test_chess_range.py +0 -14
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/pyproject.toml +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/setup.cfg +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/multi_puzzle_solver.egg-info/dependency_links.txt +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/multi_puzzle_solver.egg-info/requires.txt +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/multi_puzzle_solver.egg-info/top_level.txt +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/core/utils.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/core/utils_ortools.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/bridges/bridges.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/dominosa/dominosa.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/filling/filling.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/guess/guess.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/inertia/inertia.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/inertia/tsp.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/keen/keen.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/light_up/light_up.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/magnets/magnets.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/map/map.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/minesweeper/minesweeper.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/mosaic/mosaic.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/nonograms/nonograms.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/pearl/pearl.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/range/range.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/signpost/signpost.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/singles/singles.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/sudoku/sudoku.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/tents/tents.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/towers/towers.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/tracks/tracks.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/undead/undead.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/puzzle_solver/puzzles/unruly/unruly.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_bridges.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_dominosa.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_filling.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_guess.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_inertia.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_keen.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_light_up.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_magnets.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_map.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_minesweeper.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_mosaic.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_nonograms.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_pearl.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_range.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_signpost.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_singles.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_sudoku.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_tents.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_towers.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_tracks.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_undead.py +0 -0
- {multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/tests/test_unruly.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: multi-puzzle-solver
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.0
|
4
4
|
Summary: Efficient solvers for numerous popular and esoteric logic puzzles using CP-SAT
|
5
5
|
Author: Ar-Kareem
|
6
6
|
Project-URL: Homepage, https://github.com/Ar-Kareem/puzzle_solver
|
@@ -210,8 +210,14 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
|
|
210
210
|
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_range_unsolved.png" alt="Chess range" height="120">
|
211
211
|
</a>
|
212
212
|
</td>
|
213
|
+
<td align="center">
|
214
|
+
<a href="#chess-solo-puzzle-type-24"><b>Chess Solo</b><br><br>
|
215
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_solo_unsolved.png" alt="Chess solo" height="120">
|
216
|
+
</a>
|
217
|
+
</td>
|
218
|
+
<td align="center">
|
213
219
|
|
214
|
-
</td
|
220
|
+
</td>
|
215
221
|
</tr>
|
216
222
|
</table>
|
217
223
|
|
@@ -249,9 +255,10 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
|
|
249
255
|
- [Bridges (Puzzle Type #20)](#bridges-puzzle-type-20)
|
250
256
|
- [Inertia (Puzzle Type #21)](#inertia-puzzle-type-21)
|
251
257
|
- [Guess (Puzzle Type #22)](#guess-puzzle-type-22)
|
252
|
-
- [Chess Range(Puzzle Type #23)](#chess-
|
258
|
+
- [Chess Range (Puzzle Type #23)](#chess-range-puzzle-type-23)
|
259
|
+
- [Chess Solo (Puzzle Type #24)](#chess-solo-puzzle-type-24)
|
260
|
+
- [Chess Melee (Puzzle Type #25)](#chess-melee-puzzle-type-25)
|
253
261
|
- [Why SAT / CP-SAT?](#why-sat--cp-sat)
|
254
|
-
- [What’s Inside](#whats-inside)
|
255
262
|
- [Testing](#testing)
|
256
263
|
- [Contributing](#contributing)
|
257
264
|
- [Build and push to PyPI](#build-and-push-to-pypi)
|
@@ -1935,7 +1942,7 @@ In the case when there's only one possible choice left, the solver will inform y
|
|
1935
1942
|
|
1936
1943
|
---
|
1937
1944
|
|
1938
|
-
## Chess Range(Puzzle Type #23)
|
1945
|
+
## Chess Range (Puzzle Type #23)
|
1939
1946
|
|
1940
1947
|
* [**Play online**](https://www.puzzle-chess.com/chess-ranger-11/)
|
1941
1948
|
|
@@ -1944,7 +1951,7 @@ In the case when there's only one possible choice left, the solver will inform y
|
|
1944
1951
|
<details>
|
1945
1952
|
<summary><strong>Rules</strong></summary>
|
1946
1953
|
|
1947
|
-
You are given a chess board with $N$ pieces distributed on it. Your aim is to make $N-1$
|
1954
|
+
You are given a chess board with $N$ pieces distributed on it. Your aim is to make $N-1$ sequence of moves where each move is a legal chess move and captures another piece.
|
1948
1955
|
|
1949
1956
|
- Pieces move as standard chess pieces.
|
1950
1957
|
- You can perform only capture moves. A move that does not capture another piece is not allowed.
|
@@ -1977,7 +1984,7 @@ Solution found
|
|
1977
1984
|
['Rg2->Pc2', 'Rc2->Bc3', 'Rc3->Pd3', 'Kb6->Pb5', 'Pg4->Nf5', 'Rd3->Rb3', 'Rb3->Kb5', 'Nc6->Qe7', 'Ne7->Pf5', 'Rb5->Nf5']
|
1978
1985
|
Solutions found: 1
|
1979
1986
|
status: FEASIBLE
|
1980
|
-
Time taken:
|
1987
|
+
Time taken: 1.16 seconds
|
1981
1988
|
```
|
1982
1989
|
|
1983
1990
|
**Solved puzzle**
|
@@ -1986,6 +1993,108 @@ Time taken: 6.27 seconds
|
|
1986
1993
|
|
1987
1994
|
---
|
1988
1995
|
|
1996
|
+
## Chess Solo (Puzzle Type #24)
|
1997
|
+
|
1998
|
+
* [**Play online**](https://www.puzzle-chess.com/solo-chess-11/)
|
1999
|
+
|
2000
|
+
* [**Solver Code**][24]
|
2001
|
+
|
2002
|
+
<details>
|
2003
|
+
<summary><strong>Rules</strong></summary>
|
2004
|
+
|
2005
|
+
You are given a chess board with $N$ pieces distributed on it. Your aim is to make $N-1$ sequence of moves where each move is a legal chess move and captures another piece and end up with the king as the only piece on the board. You are not allowed to move a piece more than twice.
|
2006
|
+
|
2007
|
+
- Pieces move as standard chess pieces.
|
2008
|
+
- You can perform only capture moves. A move that does not capture another piece is not allowed.
|
2009
|
+
- You can move a piece only twice.
|
2010
|
+
- You are NOT allowed to capture the king.
|
2011
|
+
- The goal is to end up with one single piece (the king) on the board.
|
2012
|
+
|
2013
|
+
</details>
|
2014
|
+
|
2015
|
+
**Unsolved puzzle**
|
2016
|
+
|
2017
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_solo_unsolved.png" alt="Chess solo unsolved" width="500">
|
2018
|
+
|
2019
|
+
Code to utilize this package and solve the puzzle:
|
2020
|
+
|
2021
|
+
(Note that this puzzle does not typically have a unique solution. Thus, we specify here that we only want the first valid solution that the solver finds.)
|
2022
|
+
|
2023
|
+
```python
|
2024
|
+
# algebraic notation
|
2025
|
+
board = ['Kc6', 'Rc5', 'Rc4', 'Pb3', 'Bd3', 'Pd2', 'Pe3', 'Nf2', 'Ng2', 'Qg3', 'Pg6']
|
2026
|
+
binst = solver.Board(board)
|
2027
|
+
solutions = binst.solve_and_print(max_solutions=1)
|
2028
|
+
```
|
2029
|
+
**Script Output**
|
2030
|
+
|
2031
|
+
The output is in the form of "pos -> pos" where "pos" is the algebraic notation of the position.
|
2032
|
+
|
2033
|
+
```python
|
2034
|
+
Solution found
|
2035
|
+
['Qg3->Pg6', 'Qg6->Bd3', 'Pd2->Pe3', 'Ng2->Pe3', 'Nf2->Qd3', 'Ne3->Rc4', 'Pb3->Nc4', 'Nd3->Rc5', 'Kc6->Nc5', 'Kc5->Pc4']
|
2036
|
+
Solutions found: 1
|
2037
|
+
status: FEASIBLE
|
2038
|
+
Time taken: 0.47 seconds
|
2039
|
+
```
|
2040
|
+
|
2041
|
+
**Solved puzzle**
|
2042
|
+
|
2043
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_solo_solved.png" alt="Chess solo solved" width="500">
|
2044
|
+
|
2045
|
+
---
|
2046
|
+
|
2047
|
+
## Chess Melee (Puzzle Type #25)
|
2048
|
+
|
2049
|
+
* [**Play online**](https://www.puzzle-chess.com/chess-melee-13/)
|
2050
|
+
|
2051
|
+
* [**Solver Code**][25]
|
2052
|
+
|
2053
|
+
<details>
|
2054
|
+
<summary><strong>Rules</strong></summary>
|
2055
|
+
|
2056
|
+
You are given a chess board with $N$ pieces distributed on it (equal white and black pieces, one more black if $N$ is odd). Your aim is to make $N-1$ sequence of moves where each move is a legal chess move and captures another piece of the opposite color and end up with a single piece on the board. White starts and colors alternate as usual.
|
2057
|
+
|
2058
|
+
- Pieces move as standard chess pieces.
|
2059
|
+
- White moves first.
|
2060
|
+
- You can perform only capture moves. A move that does not capture another piece of the opposite color is not allowed.
|
2061
|
+
- The goal is to end up with one single piece on the board.
|
2062
|
+
|
2063
|
+
</details>
|
2064
|
+
|
2065
|
+
**Unsolved puzzle**
|
2066
|
+
|
2067
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_melee_unsolved.png" alt="Chess melee unsolved" width="500">
|
2068
|
+
|
2069
|
+
Code to utilize this package and solve the puzzle:
|
2070
|
+
|
2071
|
+
(Note that this puzzle does not typically have a unique solution. Thus, we specify here that we only want the first valid solution that the solver finds.)
|
2072
|
+
|
2073
|
+
```python
|
2074
|
+
# algebraic notation
|
2075
|
+
board = ['Pb7', 'Nc7', 'Bc6', 'Ne6', 'Pb5', 'Rc4', 'Qb3', 'Rf7', 'Rb6', 'Pe5', 'Nc3', 'Pd3', 'Nf3']
|
2076
|
+
colors = ['B', 'B', 'B', 'B', 'B', 'B', 'B', 'W', 'W', 'W', 'W', 'W', 'W']
|
2077
|
+
binst = solver.Board(board, colors)
|
2078
|
+
solutions = binst.solve_and_print()
|
2079
|
+
```
|
2080
|
+
**Script Output**
|
2081
|
+
|
2082
|
+
The output is in the form of "pos -> pos" where "pos" is the algebraic notation of the position.
|
2083
|
+
|
2084
|
+
```python
|
2085
|
+
Solution found
|
2086
|
+
['Rf7->Nc7', 'Ne6->Rc7', 'Pd3->Rc4', 'Qb3->Nc3', 'Pc4->Pb5', 'Qc3->Pe5', 'Nf3->Qe5', 'Nc7->Pb5', 'Ne5->Bc6', 'Pb7->Nc6', 'Rb6->Nb5', 'Pc6->Rb5']
|
2087
|
+
Solutions found: 1
|
2088
|
+
status: OPTIMAL
|
2089
|
+
Time taken: 6.24 seconds
|
2090
|
+
```
|
2091
|
+
|
2092
|
+
**Solved puzzle**
|
2093
|
+
|
2094
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_melee_solved.png" alt="Chess melee solved" width="500">
|
2095
|
+
|
2096
|
+
---
|
2097
|
+
|
1989
2098
|
---
|
1990
2099
|
|
1991
2100
|
## Why SAT / CP-SAT?
|
@@ -2000,36 +2109,6 @@ This repo builds those constraints in Python and uses SAT/CP-SAT (e.g., OR-Tools
|
|
2000
2109
|
|
2001
2110
|
---
|
2002
2111
|
|
2003
|
-
## What’s Inside
|
2004
|
-
|
2005
|
-
Each sub directory in `src/puzzle_solver/puzzles/` targets a different puzzle type. The following are the sub directories:
|
2006
|
-
|
2007
|
-
* `nonograms` — Picross/Griddlers (run-length constraints). ([Chapter 10][1])
|
2008
|
-
* `sudoku` — Sudoku (rows/cols/blocks all-different). ([Chapter 11][2])
|
2009
|
-
* `minesweeper` — Minesweeper (mines + counts). ([Chapter 12][3])
|
2010
|
-
* `guess` — Guess (similar to wordle, guess the colored circles). ([Chapter 15][22])
|
2011
|
-
* `dominosa` — Dominosa (dominoes + counts). ([Chapter 17][4])
|
2012
|
-
* `light_up` — *Akari* / Light Up (lighting & adjacency). ([Chapter 21][5])
|
2013
|
-
* `map` — Map (region coloring). ([Chapter 22][18])
|
2014
|
-
* `inertia` — Inertia (collect all gems without dying (with least number of moves; my addition)). ([Chapter 24][21])
|
2015
|
-
* `tents` — Tents (tree-tent matching). ([Chapter 25][6])
|
2016
|
-
* `bridges` — Bridges (island connections). ([Chapter 26][20])
|
2017
|
-
* `filling` — Filling (Fillomino-style), region sizes. ([Chapter 29][7])
|
2018
|
-
* `keen` — Keen (arithmetic operations). ([Chapter 30][8])
|
2019
|
-
* `towers` — Skyscrapers (permutation + visibility). ([Chapter 31][9])
|
2020
|
-
* `singles` — Singles (hiding numbers). ([Chapter 32][10])
|
2021
|
-
* `magnets` — Magnets (polarized dominoes + counts). ([Chapter 33][11])
|
2022
|
-
* `signpost` — Signpost (visible dominoes + counts). ([Chapter 34][12])
|
2023
|
-
* `range` — Range (rays & totals). ([Chapter 35][13])
|
2024
|
-
* `pearl` — Pearl (pearl game). ([Chapter 36][19])
|
2025
|
-
* `undead` — UnDead (Vampires/Zombies/Ghosts). ([Chapter 37][14])
|
2026
|
-
* `unruly` — Unruly (no triples + balance). ([Chapter 38][15])
|
2027
|
-
* `tracks` — Tracks (connected components). ([Chapter 40][16])
|
2028
|
-
* `mosaic` — Mosaic (Tapa-like tiling). ([Chapter 42][17])
|
2029
|
-
* `chess_range` — Chess Range (chess moves). ([Puzzle-Chess][23])
|
2030
|
-
|
2031
|
-
---
|
2032
|
-
|
2033
2112
|
## Testing
|
2034
2113
|
|
2035
2114
|
To run the tests, simply run the following (to create a fresh conda environment and install the dev dependencies):
|
@@ -2090,3 +2169,4 @@ Issues and PRs welcome!
|
|
2090
2169
|
[16]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/tracks "puzzle_solver/src/puzzle_solver/puzzles/tracks at master · Ar-Kareem/puzzle_solver · GitHub"
|
2091
2170
|
[17]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/mosaic "puzzle_solver/src/puzzle_solver/puzzles/mosaic at master · Ar-Kareem/puzzle_solver · GitHub"
|
2092
2171
|
[23]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range "puzzle_solver/src/puzzle_solver/puzzles/chess_range at master · Ar-Kareem/puzzle_solver · GitHub"
|
2172
|
+
[24]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range#chess-solo-puzzle-type-24 "puzzle_solver/src/puzzle_solver/puzzles/chess_range at master · Ar-Kareem/puzzle_solver · GitHub"
|
@@ -184,8 +184,14 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
|
|
184
184
|
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_range_unsolved.png" alt="Chess range" height="120">
|
185
185
|
</a>
|
186
186
|
</td>
|
187
|
+
<td align="center">
|
188
|
+
<a href="#chess-solo-puzzle-type-24"><b>Chess Solo</b><br><br>
|
189
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_solo_unsolved.png" alt="Chess solo" height="120">
|
190
|
+
</a>
|
191
|
+
</td>
|
192
|
+
<td align="center">
|
187
193
|
|
188
|
-
</td
|
194
|
+
</td>
|
189
195
|
</tr>
|
190
196
|
</table>
|
191
197
|
|
@@ -223,9 +229,10 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
|
|
223
229
|
- [Bridges (Puzzle Type #20)](#bridges-puzzle-type-20)
|
224
230
|
- [Inertia (Puzzle Type #21)](#inertia-puzzle-type-21)
|
225
231
|
- [Guess (Puzzle Type #22)](#guess-puzzle-type-22)
|
226
|
-
- [Chess Range(Puzzle Type #23)](#chess-
|
232
|
+
- [Chess Range (Puzzle Type #23)](#chess-range-puzzle-type-23)
|
233
|
+
- [Chess Solo (Puzzle Type #24)](#chess-solo-puzzle-type-24)
|
234
|
+
- [Chess Melee (Puzzle Type #25)](#chess-melee-puzzle-type-25)
|
227
235
|
- [Why SAT / CP-SAT?](#why-sat--cp-sat)
|
228
|
-
- [What’s Inside](#whats-inside)
|
229
236
|
- [Testing](#testing)
|
230
237
|
- [Contributing](#contributing)
|
231
238
|
- [Build and push to PyPI](#build-and-push-to-pypi)
|
@@ -1909,7 +1916,7 @@ In the case when there's only one possible choice left, the solver will inform y
|
|
1909
1916
|
|
1910
1917
|
---
|
1911
1918
|
|
1912
|
-
## Chess Range(Puzzle Type #23)
|
1919
|
+
## Chess Range (Puzzle Type #23)
|
1913
1920
|
|
1914
1921
|
* [**Play online**](https://www.puzzle-chess.com/chess-ranger-11/)
|
1915
1922
|
|
@@ -1918,7 +1925,7 @@ In the case when there's only one possible choice left, the solver will inform y
|
|
1918
1925
|
<details>
|
1919
1926
|
<summary><strong>Rules</strong></summary>
|
1920
1927
|
|
1921
|
-
You are given a chess board with $N$ pieces distributed on it. Your aim is to make $N-1$
|
1928
|
+
You are given a chess board with $N$ pieces distributed on it. Your aim is to make $N-1$ sequence of moves where each move is a legal chess move and captures another piece.
|
1922
1929
|
|
1923
1930
|
- Pieces move as standard chess pieces.
|
1924
1931
|
- You can perform only capture moves. A move that does not capture another piece is not allowed.
|
@@ -1951,7 +1958,7 @@ Solution found
|
|
1951
1958
|
['Rg2->Pc2', 'Rc2->Bc3', 'Rc3->Pd3', 'Kb6->Pb5', 'Pg4->Nf5', 'Rd3->Rb3', 'Rb3->Kb5', 'Nc6->Qe7', 'Ne7->Pf5', 'Rb5->Nf5']
|
1952
1959
|
Solutions found: 1
|
1953
1960
|
status: FEASIBLE
|
1954
|
-
Time taken:
|
1961
|
+
Time taken: 1.16 seconds
|
1955
1962
|
```
|
1956
1963
|
|
1957
1964
|
**Solved puzzle**
|
@@ -1960,6 +1967,108 @@ Time taken: 6.27 seconds
|
|
1960
1967
|
|
1961
1968
|
---
|
1962
1969
|
|
1970
|
+
## Chess Solo (Puzzle Type #24)
|
1971
|
+
|
1972
|
+
* [**Play online**](https://www.puzzle-chess.com/solo-chess-11/)
|
1973
|
+
|
1974
|
+
* [**Solver Code**][24]
|
1975
|
+
|
1976
|
+
<details>
|
1977
|
+
<summary><strong>Rules</strong></summary>
|
1978
|
+
|
1979
|
+
You are given a chess board with $N$ pieces distributed on it. Your aim is to make $N-1$ sequence of moves where each move is a legal chess move and captures another piece and end up with the king as the only piece on the board. You are not allowed to move a piece more than twice.
|
1980
|
+
|
1981
|
+
- Pieces move as standard chess pieces.
|
1982
|
+
- You can perform only capture moves. A move that does not capture another piece is not allowed.
|
1983
|
+
- You can move a piece only twice.
|
1984
|
+
- You are NOT allowed to capture the king.
|
1985
|
+
- The goal is to end up with one single piece (the king) on the board.
|
1986
|
+
|
1987
|
+
</details>
|
1988
|
+
|
1989
|
+
**Unsolved puzzle**
|
1990
|
+
|
1991
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_solo_unsolved.png" alt="Chess solo unsolved" width="500">
|
1992
|
+
|
1993
|
+
Code to utilize this package and solve the puzzle:
|
1994
|
+
|
1995
|
+
(Note that this puzzle does not typically have a unique solution. Thus, we specify here that we only want the first valid solution that the solver finds.)
|
1996
|
+
|
1997
|
+
```python
|
1998
|
+
# algebraic notation
|
1999
|
+
board = ['Kc6', 'Rc5', 'Rc4', 'Pb3', 'Bd3', 'Pd2', 'Pe3', 'Nf2', 'Ng2', 'Qg3', 'Pg6']
|
2000
|
+
binst = solver.Board(board)
|
2001
|
+
solutions = binst.solve_and_print(max_solutions=1)
|
2002
|
+
```
|
2003
|
+
**Script Output**
|
2004
|
+
|
2005
|
+
The output is in the form of "pos -> pos" where "pos" is the algebraic notation of the position.
|
2006
|
+
|
2007
|
+
```python
|
2008
|
+
Solution found
|
2009
|
+
['Qg3->Pg6', 'Qg6->Bd3', 'Pd2->Pe3', 'Ng2->Pe3', 'Nf2->Qd3', 'Ne3->Rc4', 'Pb3->Nc4', 'Nd3->Rc5', 'Kc6->Nc5', 'Kc5->Pc4']
|
2010
|
+
Solutions found: 1
|
2011
|
+
status: FEASIBLE
|
2012
|
+
Time taken: 0.47 seconds
|
2013
|
+
```
|
2014
|
+
|
2015
|
+
**Solved puzzle**
|
2016
|
+
|
2017
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_solo_solved.png" alt="Chess solo solved" width="500">
|
2018
|
+
|
2019
|
+
---
|
2020
|
+
|
2021
|
+
## Chess Melee (Puzzle Type #25)
|
2022
|
+
|
2023
|
+
* [**Play online**](https://www.puzzle-chess.com/chess-melee-13/)
|
2024
|
+
|
2025
|
+
* [**Solver Code**][25]
|
2026
|
+
|
2027
|
+
<details>
|
2028
|
+
<summary><strong>Rules</strong></summary>
|
2029
|
+
|
2030
|
+
You are given a chess board with $N$ pieces distributed on it (equal white and black pieces, one more black if $N$ is odd). Your aim is to make $N-1$ sequence of moves where each move is a legal chess move and captures another piece of the opposite color and end up with a single piece on the board. White starts and colors alternate as usual.
|
2031
|
+
|
2032
|
+
- Pieces move as standard chess pieces.
|
2033
|
+
- White moves first.
|
2034
|
+
- You can perform only capture moves. A move that does not capture another piece of the opposite color is not allowed.
|
2035
|
+
- The goal is to end up with one single piece on the board.
|
2036
|
+
|
2037
|
+
</details>
|
2038
|
+
|
2039
|
+
**Unsolved puzzle**
|
2040
|
+
|
2041
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_melee_unsolved.png" alt="Chess melee unsolved" width="500">
|
2042
|
+
|
2043
|
+
Code to utilize this package and solve the puzzle:
|
2044
|
+
|
2045
|
+
(Note that this puzzle does not typically have a unique solution. Thus, we specify here that we only want the first valid solution that the solver finds.)
|
2046
|
+
|
2047
|
+
```python
|
2048
|
+
# algebraic notation
|
2049
|
+
board = ['Pb7', 'Nc7', 'Bc6', 'Ne6', 'Pb5', 'Rc4', 'Qb3', 'Rf7', 'Rb6', 'Pe5', 'Nc3', 'Pd3', 'Nf3']
|
2050
|
+
colors = ['B', 'B', 'B', 'B', 'B', 'B', 'B', 'W', 'W', 'W', 'W', 'W', 'W']
|
2051
|
+
binst = solver.Board(board, colors)
|
2052
|
+
solutions = binst.solve_and_print()
|
2053
|
+
```
|
2054
|
+
**Script Output**
|
2055
|
+
|
2056
|
+
The output is in the form of "pos -> pos" where "pos" is the algebraic notation of the position.
|
2057
|
+
|
2058
|
+
```python
|
2059
|
+
Solution found
|
2060
|
+
['Rf7->Nc7', 'Ne6->Rc7', 'Pd3->Rc4', 'Qb3->Nc3', 'Pc4->Pb5', 'Qc3->Pe5', 'Nf3->Qe5', 'Nc7->Pb5', 'Ne5->Bc6', 'Pb7->Nc6', 'Rb6->Nb5', 'Pc6->Rb5']
|
2061
|
+
Solutions found: 1
|
2062
|
+
status: OPTIMAL
|
2063
|
+
Time taken: 6.24 seconds
|
2064
|
+
```
|
2065
|
+
|
2066
|
+
**Solved puzzle**
|
2067
|
+
|
2068
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_melee_solved.png" alt="Chess melee solved" width="500">
|
2069
|
+
|
2070
|
+
---
|
2071
|
+
|
1963
2072
|
---
|
1964
2073
|
|
1965
2074
|
## Why SAT / CP-SAT?
|
@@ -1974,36 +2083,6 @@ This repo builds those constraints in Python and uses SAT/CP-SAT (e.g., OR-Tools
|
|
1974
2083
|
|
1975
2084
|
---
|
1976
2085
|
|
1977
|
-
## What’s Inside
|
1978
|
-
|
1979
|
-
Each sub directory in `src/puzzle_solver/puzzles/` targets a different puzzle type. The following are the sub directories:
|
1980
|
-
|
1981
|
-
* `nonograms` — Picross/Griddlers (run-length constraints). ([Chapter 10][1])
|
1982
|
-
* `sudoku` — Sudoku (rows/cols/blocks all-different). ([Chapter 11][2])
|
1983
|
-
* `minesweeper` — Minesweeper (mines + counts). ([Chapter 12][3])
|
1984
|
-
* `guess` — Guess (similar to wordle, guess the colored circles). ([Chapter 15][22])
|
1985
|
-
* `dominosa` — Dominosa (dominoes + counts). ([Chapter 17][4])
|
1986
|
-
* `light_up` — *Akari* / Light Up (lighting & adjacency). ([Chapter 21][5])
|
1987
|
-
* `map` — Map (region coloring). ([Chapter 22][18])
|
1988
|
-
* `inertia` — Inertia (collect all gems without dying (with least number of moves; my addition)). ([Chapter 24][21])
|
1989
|
-
* `tents` — Tents (tree-tent matching). ([Chapter 25][6])
|
1990
|
-
* `bridges` — Bridges (island connections). ([Chapter 26][20])
|
1991
|
-
* `filling` — Filling (Fillomino-style), region sizes. ([Chapter 29][7])
|
1992
|
-
* `keen` — Keen (arithmetic operations). ([Chapter 30][8])
|
1993
|
-
* `towers` — Skyscrapers (permutation + visibility). ([Chapter 31][9])
|
1994
|
-
* `singles` — Singles (hiding numbers). ([Chapter 32][10])
|
1995
|
-
* `magnets` — Magnets (polarized dominoes + counts). ([Chapter 33][11])
|
1996
|
-
* `signpost` — Signpost (visible dominoes + counts). ([Chapter 34][12])
|
1997
|
-
* `range` — Range (rays & totals). ([Chapter 35][13])
|
1998
|
-
* `pearl` — Pearl (pearl game). ([Chapter 36][19])
|
1999
|
-
* `undead` — UnDead (Vampires/Zombies/Ghosts). ([Chapter 37][14])
|
2000
|
-
* `unruly` — Unruly (no triples + balance). ([Chapter 38][15])
|
2001
|
-
* `tracks` — Tracks (connected components). ([Chapter 40][16])
|
2002
|
-
* `mosaic` — Mosaic (Tapa-like tiling). ([Chapter 42][17])
|
2003
|
-
* `chess_range` — Chess Range (chess moves). ([Puzzle-Chess][23])
|
2004
|
-
|
2005
|
-
---
|
2006
|
-
|
2007
2086
|
## Testing
|
2008
2087
|
|
2009
2088
|
To run the tests, simply run the following (to create a fresh conda environment and install the dev dependencies):
|
@@ -2063,4 +2142,5 @@ Issues and PRs welcome!
|
|
2063
2142
|
[15]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/unruly "puzzle_solver/src/puzzle_solver/puzzles/unruly at master · Ar-Kareem/puzzle_solver · GitHub"
|
2064
2143
|
[16]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/tracks "puzzle_solver/src/puzzle_solver/puzzles/tracks at master · Ar-Kareem/puzzle_solver · GitHub"
|
2065
2144
|
[17]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/mosaic "puzzle_solver/src/puzzle_solver/puzzles/mosaic at master · Ar-Kareem/puzzle_solver · GitHub"
|
2066
|
-
[23]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range "puzzle_solver/src/puzzle_solver/puzzles/chess_range at master · Ar-Kareem/puzzle_solver · GitHub"
|
2145
|
+
[23]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range "puzzle_solver/src/puzzle_solver/puzzles/chess_range at master · Ar-Kareem/puzzle_solver · GitHub"
|
2146
|
+
[24]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range#chess-solo-puzzle-type-24 "puzzle_solver/src/puzzle_solver/puzzles/chess_range at master · Ar-Kareem/puzzle_solver · GitHub"
|
{multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/multi_puzzle_solver.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: multi-puzzle-solver
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.0
|
4
4
|
Summary: Efficient solvers for numerous popular and esoteric logic puzzles using CP-SAT
|
5
5
|
Author: Ar-Kareem
|
6
6
|
Project-URL: Homepage, https://github.com/Ar-Kareem/puzzle_solver
|
@@ -210,8 +210,14 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
|
|
210
210
|
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_range_unsolved.png" alt="Chess range" height="120">
|
211
211
|
</a>
|
212
212
|
</td>
|
213
|
+
<td align="center">
|
214
|
+
<a href="#chess-solo-puzzle-type-24"><b>Chess Solo</b><br><br>
|
215
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_solo_unsolved.png" alt="Chess solo" height="120">
|
216
|
+
</a>
|
217
|
+
</td>
|
218
|
+
<td align="center">
|
213
219
|
|
214
|
-
</td
|
220
|
+
</td>
|
215
221
|
</tr>
|
216
222
|
</table>
|
217
223
|
|
@@ -249,9 +255,10 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
|
|
249
255
|
- [Bridges (Puzzle Type #20)](#bridges-puzzle-type-20)
|
250
256
|
- [Inertia (Puzzle Type #21)](#inertia-puzzle-type-21)
|
251
257
|
- [Guess (Puzzle Type #22)](#guess-puzzle-type-22)
|
252
|
-
- [Chess Range(Puzzle Type #23)](#chess-
|
258
|
+
- [Chess Range (Puzzle Type #23)](#chess-range-puzzle-type-23)
|
259
|
+
- [Chess Solo (Puzzle Type #24)](#chess-solo-puzzle-type-24)
|
260
|
+
- [Chess Melee (Puzzle Type #25)](#chess-melee-puzzle-type-25)
|
253
261
|
- [Why SAT / CP-SAT?](#why-sat--cp-sat)
|
254
|
-
- [What’s Inside](#whats-inside)
|
255
262
|
- [Testing](#testing)
|
256
263
|
- [Contributing](#contributing)
|
257
264
|
- [Build and push to PyPI](#build-and-push-to-pypi)
|
@@ -1935,7 +1942,7 @@ In the case when there's only one possible choice left, the solver will inform y
|
|
1935
1942
|
|
1936
1943
|
---
|
1937
1944
|
|
1938
|
-
## Chess Range(Puzzle Type #23)
|
1945
|
+
## Chess Range (Puzzle Type #23)
|
1939
1946
|
|
1940
1947
|
* [**Play online**](https://www.puzzle-chess.com/chess-ranger-11/)
|
1941
1948
|
|
@@ -1944,7 +1951,7 @@ In the case when there's only one possible choice left, the solver will inform y
|
|
1944
1951
|
<details>
|
1945
1952
|
<summary><strong>Rules</strong></summary>
|
1946
1953
|
|
1947
|
-
You are given a chess board with $N$ pieces distributed on it. Your aim is to make $N-1$
|
1954
|
+
You are given a chess board with $N$ pieces distributed on it. Your aim is to make $N-1$ sequence of moves where each move is a legal chess move and captures another piece.
|
1948
1955
|
|
1949
1956
|
- Pieces move as standard chess pieces.
|
1950
1957
|
- You can perform only capture moves. A move that does not capture another piece is not allowed.
|
@@ -1977,7 +1984,7 @@ Solution found
|
|
1977
1984
|
['Rg2->Pc2', 'Rc2->Bc3', 'Rc3->Pd3', 'Kb6->Pb5', 'Pg4->Nf5', 'Rd3->Rb3', 'Rb3->Kb5', 'Nc6->Qe7', 'Ne7->Pf5', 'Rb5->Nf5']
|
1978
1985
|
Solutions found: 1
|
1979
1986
|
status: FEASIBLE
|
1980
|
-
Time taken:
|
1987
|
+
Time taken: 1.16 seconds
|
1981
1988
|
```
|
1982
1989
|
|
1983
1990
|
**Solved puzzle**
|
@@ -1986,6 +1993,108 @@ Time taken: 6.27 seconds
|
|
1986
1993
|
|
1987
1994
|
---
|
1988
1995
|
|
1996
|
+
## Chess Solo (Puzzle Type #24)
|
1997
|
+
|
1998
|
+
* [**Play online**](https://www.puzzle-chess.com/solo-chess-11/)
|
1999
|
+
|
2000
|
+
* [**Solver Code**][24]
|
2001
|
+
|
2002
|
+
<details>
|
2003
|
+
<summary><strong>Rules</strong></summary>
|
2004
|
+
|
2005
|
+
You are given a chess board with $N$ pieces distributed on it. Your aim is to make $N-1$ sequence of moves where each move is a legal chess move and captures another piece and end up with the king as the only piece on the board. You are not allowed to move a piece more than twice.
|
2006
|
+
|
2007
|
+
- Pieces move as standard chess pieces.
|
2008
|
+
- You can perform only capture moves. A move that does not capture another piece is not allowed.
|
2009
|
+
- You can move a piece only twice.
|
2010
|
+
- You are NOT allowed to capture the king.
|
2011
|
+
- The goal is to end up with one single piece (the king) on the board.
|
2012
|
+
|
2013
|
+
</details>
|
2014
|
+
|
2015
|
+
**Unsolved puzzle**
|
2016
|
+
|
2017
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_solo_unsolved.png" alt="Chess solo unsolved" width="500">
|
2018
|
+
|
2019
|
+
Code to utilize this package and solve the puzzle:
|
2020
|
+
|
2021
|
+
(Note that this puzzle does not typically have a unique solution. Thus, we specify here that we only want the first valid solution that the solver finds.)
|
2022
|
+
|
2023
|
+
```python
|
2024
|
+
# algebraic notation
|
2025
|
+
board = ['Kc6', 'Rc5', 'Rc4', 'Pb3', 'Bd3', 'Pd2', 'Pe3', 'Nf2', 'Ng2', 'Qg3', 'Pg6']
|
2026
|
+
binst = solver.Board(board)
|
2027
|
+
solutions = binst.solve_and_print(max_solutions=1)
|
2028
|
+
```
|
2029
|
+
**Script Output**
|
2030
|
+
|
2031
|
+
The output is in the form of "pos -> pos" where "pos" is the algebraic notation of the position.
|
2032
|
+
|
2033
|
+
```python
|
2034
|
+
Solution found
|
2035
|
+
['Qg3->Pg6', 'Qg6->Bd3', 'Pd2->Pe3', 'Ng2->Pe3', 'Nf2->Qd3', 'Ne3->Rc4', 'Pb3->Nc4', 'Nd3->Rc5', 'Kc6->Nc5', 'Kc5->Pc4']
|
2036
|
+
Solutions found: 1
|
2037
|
+
status: FEASIBLE
|
2038
|
+
Time taken: 0.47 seconds
|
2039
|
+
```
|
2040
|
+
|
2041
|
+
**Solved puzzle**
|
2042
|
+
|
2043
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_solo_solved.png" alt="Chess solo solved" width="500">
|
2044
|
+
|
2045
|
+
---
|
2046
|
+
|
2047
|
+
## Chess Melee (Puzzle Type #25)
|
2048
|
+
|
2049
|
+
* [**Play online**](https://www.puzzle-chess.com/chess-melee-13/)
|
2050
|
+
|
2051
|
+
* [**Solver Code**][25]
|
2052
|
+
|
2053
|
+
<details>
|
2054
|
+
<summary><strong>Rules</strong></summary>
|
2055
|
+
|
2056
|
+
You are given a chess board with $N$ pieces distributed on it (equal white and black pieces, one more black if $N$ is odd). Your aim is to make $N-1$ sequence of moves where each move is a legal chess move and captures another piece of the opposite color and end up with a single piece on the board. White starts and colors alternate as usual.
|
2057
|
+
|
2058
|
+
- Pieces move as standard chess pieces.
|
2059
|
+
- White moves first.
|
2060
|
+
- You can perform only capture moves. A move that does not capture another piece of the opposite color is not allowed.
|
2061
|
+
- The goal is to end up with one single piece on the board.
|
2062
|
+
|
2063
|
+
</details>
|
2064
|
+
|
2065
|
+
**Unsolved puzzle**
|
2066
|
+
|
2067
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_melee_unsolved.png" alt="Chess melee unsolved" width="500">
|
2068
|
+
|
2069
|
+
Code to utilize this package and solve the puzzle:
|
2070
|
+
|
2071
|
+
(Note that this puzzle does not typically have a unique solution. Thus, we specify here that we only want the first valid solution that the solver finds.)
|
2072
|
+
|
2073
|
+
```python
|
2074
|
+
# algebraic notation
|
2075
|
+
board = ['Pb7', 'Nc7', 'Bc6', 'Ne6', 'Pb5', 'Rc4', 'Qb3', 'Rf7', 'Rb6', 'Pe5', 'Nc3', 'Pd3', 'Nf3']
|
2076
|
+
colors = ['B', 'B', 'B', 'B', 'B', 'B', 'B', 'W', 'W', 'W', 'W', 'W', 'W']
|
2077
|
+
binst = solver.Board(board, colors)
|
2078
|
+
solutions = binst.solve_and_print()
|
2079
|
+
```
|
2080
|
+
**Script Output**
|
2081
|
+
|
2082
|
+
The output is in the form of "pos -> pos" where "pos" is the algebraic notation of the position.
|
2083
|
+
|
2084
|
+
```python
|
2085
|
+
Solution found
|
2086
|
+
['Rf7->Nc7', 'Ne6->Rc7', 'Pd3->Rc4', 'Qb3->Nc3', 'Pc4->Pb5', 'Qc3->Pe5', 'Nf3->Qe5', 'Nc7->Pb5', 'Ne5->Bc6', 'Pb7->Nc6', 'Rb6->Nb5', 'Pc6->Rb5']
|
2087
|
+
Solutions found: 1
|
2088
|
+
status: OPTIMAL
|
2089
|
+
Time taken: 6.24 seconds
|
2090
|
+
```
|
2091
|
+
|
2092
|
+
**Solved puzzle**
|
2093
|
+
|
2094
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/chess_melee_solved.png" alt="Chess melee solved" width="500">
|
2095
|
+
|
2096
|
+
---
|
2097
|
+
|
1989
2098
|
---
|
1990
2099
|
|
1991
2100
|
## Why SAT / CP-SAT?
|
@@ -2000,36 +2109,6 @@ This repo builds those constraints in Python and uses SAT/CP-SAT (e.g., OR-Tools
|
|
2000
2109
|
|
2001
2110
|
---
|
2002
2111
|
|
2003
|
-
## What’s Inside
|
2004
|
-
|
2005
|
-
Each sub directory in `src/puzzle_solver/puzzles/` targets a different puzzle type. The following are the sub directories:
|
2006
|
-
|
2007
|
-
* `nonograms` — Picross/Griddlers (run-length constraints). ([Chapter 10][1])
|
2008
|
-
* `sudoku` — Sudoku (rows/cols/blocks all-different). ([Chapter 11][2])
|
2009
|
-
* `minesweeper` — Minesweeper (mines + counts). ([Chapter 12][3])
|
2010
|
-
* `guess` — Guess (similar to wordle, guess the colored circles). ([Chapter 15][22])
|
2011
|
-
* `dominosa` — Dominosa (dominoes + counts). ([Chapter 17][4])
|
2012
|
-
* `light_up` — *Akari* / Light Up (lighting & adjacency). ([Chapter 21][5])
|
2013
|
-
* `map` — Map (region coloring). ([Chapter 22][18])
|
2014
|
-
* `inertia` — Inertia (collect all gems without dying (with least number of moves; my addition)). ([Chapter 24][21])
|
2015
|
-
* `tents` — Tents (tree-tent matching). ([Chapter 25][6])
|
2016
|
-
* `bridges` — Bridges (island connections). ([Chapter 26][20])
|
2017
|
-
* `filling` — Filling (Fillomino-style), region sizes. ([Chapter 29][7])
|
2018
|
-
* `keen` — Keen (arithmetic operations). ([Chapter 30][8])
|
2019
|
-
* `towers` — Skyscrapers (permutation + visibility). ([Chapter 31][9])
|
2020
|
-
* `singles` — Singles (hiding numbers). ([Chapter 32][10])
|
2021
|
-
* `magnets` — Magnets (polarized dominoes + counts). ([Chapter 33][11])
|
2022
|
-
* `signpost` — Signpost (visible dominoes + counts). ([Chapter 34][12])
|
2023
|
-
* `range` — Range (rays & totals). ([Chapter 35][13])
|
2024
|
-
* `pearl` — Pearl (pearl game). ([Chapter 36][19])
|
2025
|
-
* `undead` — UnDead (Vampires/Zombies/Ghosts). ([Chapter 37][14])
|
2026
|
-
* `unruly` — Unruly (no triples + balance). ([Chapter 38][15])
|
2027
|
-
* `tracks` — Tracks (connected components). ([Chapter 40][16])
|
2028
|
-
* `mosaic` — Mosaic (Tapa-like tiling). ([Chapter 42][17])
|
2029
|
-
* `chess_range` — Chess Range (chess moves). ([Puzzle-Chess][23])
|
2030
|
-
|
2031
|
-
---
|
2032
|
-
|
2033
2112
|
## Testing
|
2034
2113
|
|
2035
2114
|
To run the tests, simply run the following (to create a fresh conda environment and install the dev dependencies):
|
@@ -2090,3 +2169,4 @@ Issues and PRs welcome!
|
|
2090
2169
|
[16]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/tracks "puzzle_solver/src/puzzle_solver/puzzles/tracks at master · Ar-Kareem/puzzle_solver · GitHub"
|
2091
2170
|
[17]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/mosaic "puzzle_solver/src/puzzle_solver/puzzles/mosaic at master · Ar-Kareem/puzzle_solver · GitHub"
|
2092
2171
|
[23]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range "puzzle_solver/src/puzzle_solver/puzzles/chess_range at master · Ar-Kareem/puzzle_solver · GitHub"
|
2172
|
+
[24]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range#chess-solo-puzzle-type-24 "puzzle_solver/src/puzzle_solver/puzzles/chess_range at master · Ar-Kareem/puzzle_solver · GitHub"
|
{multi_puzzle_solver-0.8.7 → multi_puzzle_solver-0.9.0}/src/multi_puzzle_solver.egg-info/SOURCES.txt
RENAMED
@@ -9,7 +9,9 @@ src/puzzle_solver/__init__.py
|
|
9
9
|
src/puzzle_solver/core/utils.py
|
10
10
|
src/puzzle_solver/core/utils_ortools.py
|
11
11
|
src/puzzle_solver/puzzles/bridges/bridges.py
|
12
|
+
src/puzzle_solver/puzzles/chess_range/chess_melee.py
|
12
13
|
src/puzzle_solver/puzzles/chess_range/chess_range.py
|
14
|
+
src/puzzle_solver/puzzles/chess_range/chess_solo.py
|
13
15
|
src/puzzle_solver/puzzles/dominosa/dominosa.py
|
14
16
|
src/puzzle_solver/puzzles/filling/filling.py
|
15
17
|
src/puzzle_solver/puzzles/guess/guess.py
|
@@ -34,7 +36,9 @@ src/puzzle_solver/puzzles/tracks/tracks.py
|
|
34
36
|
src/puzzle_solver/puzzles/undead/undead.py
|
35
37
|
src/puzzle_solver/puzzles/unruly/unruly.py
|
36
38
|
tests/test_bridges.py
|
39
|
+
tests/test_chess_melee.py
|
37
40
|
tests/test_chess_range.py
|
41
|
+
tests/test_chess_solo.py
|
38
42
|
tests/test_dominosa.py
|
39
43
|
tests/test_filling.py
|
40
44
|
tests/test_guess.py
|
@@ -1,5 +1,7 @@
|
|
1
1
|
from puzzle_solver.puzzles.bridges import bridges as bridges_solver
|
2
2
|
from puzzle_solver.puzzles.chess_range import chess_range as chess_range_solver
|
3
|
+
from puzzle_solver.puzzles.chess_range import chess_solo as chess_solo_solver
|
4
|
+
from puzzle_solver.puzzles.chess_range import chess_melee as chess_melee_solver
|
3
5
|
from puzzle_solver.puzzles.dominosa import dominosa as dominosa_solver
|
4
6
|
from puzzle_solver.puzzles.filling import filling as filling_solver
|
5
7
|
from puzzle_solver.puzzles.guess import guess as guess_solver
|
@@ -24,4 +26,4 @@ from puzzle_solver.puzzles.unruly import unruly as unruly_solver
|
|
24
26
|
|
25
27
|
from puzzle_solver.puzzles.inertia.parse_map.parse_map import main as inertia_image_parser
|
26
28
|
|
27
|
-
__version__ = '0.
|
29
|
+
__version__ = '0.9.0'
|