multi-puzzle-solver 0.9.20__tar.gz → 0.9.22__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.
Potentially problematic release.
This version of multi-puzzle-solver might be problematic. Click here for more details.
- {multi_puzzle_solver-0.9.20/src/multi_puzzle_solver.egg-info → multi_puzzle_solver-0.9.22}/PKG-INFO +122 -3
- multi_puzzle_solver-0.9.20/PKG-INFO → multi_puzzle_solver-0.9.22/README.md +3570 -3477
- multi_puzzle_solver-0.9.20/README.md → multi_puzzle_solver-0.9.22/src/multi_puzzle_solver.egg-info/PKG-INFO +3596 -3451
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/multi_puzzle_solver.egg-info/SOURCES.txt +4 -1
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/__init__.py +2 -1
- multi_puzzle_solver-0.9.22/src/puzzle_solver/puzzles/sudoku/sudoku.py +203 -0
- multi_puzzle_solver-0.9.22/src/puzzle_solver/puzzles/yin_yang/parse_map/parse_map.py +169 -0
- multi_puzzle_solver-0.9.22/src/puzzle_solver/puzzles/yin_yang/yin_yang.py +110 -0
- multi_puzzle_solver-0.9.22/tests/test_sudoku.py +176 -0
- multi_puzzle_solver-0.9.22/tests/test_yin_yang.py +176 -0
- multi_puzzle_solver-0.9.20/src/puzzle_solver/puzzles/sudoku/sudoku.py +0 -90
- multi_puzzle_solver-0.9.20/tests/test_sudoku.py +0 -59
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/pyproject.toml +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/setup.cfg +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/multi_puzzle_solver.egg-info/dependency_links.txt +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/multi_puzzle_solver.egg-info/requires.txt +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/multi_puzzle_solver.egg-info/top_level.txt +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/core/utils.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/core/utils_ortools.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/aquarium/aquarium.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/battleships/battleships.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/black_box/black_box.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/bridges/bridges.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/chess_range/chess_melee.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/chess_range/chess_range.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/chess_range/chess_solo.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/dominosa/dominosa.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/filling/filling.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/galaxies/galaxies.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/galaxies/parse_map/parse_map.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/guess/guess.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/inertia/inertia.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/inertia/parse_map/parse_map.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/inertia/tsp.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/kakurasu/kakurasu.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/keen/keen.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/light_up/light_up.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/lits/lits.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/magnets/magnets.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/map/map.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/minesweeper/minesweeper.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/mosaic/mosaic.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/nonograms/nonograms.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/norinori/norinori.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/pearl/pearl.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/range/range.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/signpost/signpost.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/singles/singles.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/slant/parse_map/parse_map.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/slant/slant.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/slitherlink/slitherlink.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/star_battle/star_battle.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/star_battle/star_battle_shapeless.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/stitches/parse_map/parse_map.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/stitches/stitches.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/tents/tents.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/thermometers/thermometers.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/towers/towers.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/tracks/tracks.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/undead/undead.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/unequal/unequal.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/unruly/unruly.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/utils/visualizer.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_aquarium.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_battleships.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_black_box.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_bridges.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_chess_melee.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_chess_range.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_chess_solo.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_dominosa.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_filling.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_galaxies.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_guess.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_inertia.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_kakurasu.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_keen.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_light_up.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_lits.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_magnets.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_map.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_minesweeper.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_mosaic.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_nonograms.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_norinori.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_pearl.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_range.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_signpost.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_singles.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_slant.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_slitherlink.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_star_battle.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_stitches.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_tents.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_thermometers.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_towers.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_tracks.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_undead.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_unequal.py +0 -0
- {multi_puzzle_solver-0.9.20 → multi_puzzle_solver-0.9.22}/tests/test_unruly.py +0 -0
{multi_puzzle_solver-0.9.20/src/multi_puzzle_solver.egg-info → multi_puzzle_solver-0.9.22}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: multi-puzzle-solver
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.22
|
|
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
|
|
@@ -309,6 +309,11 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
|
|
|
309
309
|
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/slitherlink_solved.png" alt="Slitherlink" width="140">
|
|
310
310
|
</a>
|
|
311
311
|
</td>
|
|
312
|
+
<td align="center">
|
|
313
|
+
<a href="#yin-yang-puzzle-type-40"><b>Yin-Yang</b><br><br>
|
|
314
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/yin_yang_solved.png" alt="Yin-Yang" width="140">
|
|
315
|
+
</a>
|
|
316
|
+
</td>
|
|
312
317
|
</tr>
|
|
313
318
|
</table>
|
|
314
319
|
|
|
@@ -363,6 +368,7 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
|
|
|
363
368
|
- [Unequal (Puzzle Type #37)](#unequal-puzzle-type-37)
|
|
364
369
|
- [Norinori (Puzzle Type #38)](#norinori-puzzle-type-38)
|
|
365
370
|
- [Slitherlink (Puzzle Type #39)](#slitherlink-puzzle-type-39)
|
|
371
|
+
- [Yin-Yang (Puzzle Type #40)](#yin-yang-puzzle-type-40)
|
|
366
372
|
- [Why SAT / CP-SAT?](#why-sat--cp-sat)
|
|
367
373
|
- [Testing](#testing)
|
|
368
374
|
- [Contributing](#contributing)
|
|
@@ -488,6 +494,13 @@ You are given some of the numbers as clues; your aim is to place the rest of the
|
|
|
488
494
|
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/sudoku_unsolved.png" alt="Sudoku unsolved" width="500">
|
|
489
495
|
|
|
490
496
|
Code to utilize this package and solve the puzzle:
|
|
497
|
+
|
|
498
|
+
Note:
|
|
499
|
+
|
|
500
|
+
- The solver also supports solving the ["Sandwich" sudoku variant](https://dkmgames.com/SandwichSudoku/) through the optional parameter ``sandwich={'side': [...], 'bottom': [...] }``。
|
|
501
|
+
|
|
502
|
+
- The solver also supports solving the ["Sudoku-X" variant](https://www.sudopedia.org/wiki/Sudoku-X) through the optional parameter ``unique_diagonal=True``。
|
|
503
|
+
|
|
491
504
|
```python
|
|
492
505
|
import numpy as np
|
|
493
506
|
from puzzle_solver import sudoku_solver as solver
|
|
@@ -2220,6 +2233,7 @@ The numbers outside the grid show the number of filled cells horizontally and ve
|
|
|
2220
2233
|
Code to utilize this package and solve the puzzle:
|
|
2221
2234
|
|
|
2222
2235
|
```python
|
|
2236
|
+
import numpy as np
|
|
2223
2237
|
from puzzle_solver import thermometers_solver as solver
|
|
2224
2238
|
board = np.array([
|
|
2225
2239
|
['R', 'R', 'D', 'R', 'D', 'R', 'X', 'D', 'L', 'X', 'L', 'L', 'L', 'L', 'L'],
|
|
@@ -2299,6 +2313,7 @@ The numbers outside the grid show the number of filled cells horizontally and ve
|
|
|
2299
2313
|
Code to utilize this package and solve the puzzle:
|
|
2300
2314
|
|
|
2301
2315
|
```python
|
|
2316
|
+
import numpy as np
|
|
2302
2317
|
from puzzle_solver import aquarium_solver as solver
|
|
2303
2318
|
board = np.array([
|
|
2304
2319
|
['01', '01', '01', '01', '02', '02', '02', '03', '03', '03', '03', '04', '05', '05', '05'],
|
|
@@ -2376,6 +2391,7 @@ Time taken: 0.02 seconds
|
|
|
2376
2391
|
Code to utilize this package and solve the puzzle:
|
|
2377
2392
|
|
|
2378
2393
|
```python
|
|
2394
|
+
import numpy as np
|
|
2379
2395
|
from puzzle_solver import stitches_solver as solver
|
|
2380
2396
|
board = np.array([
|
|
2381
2397
|
["00", "00", "00", "00", "00", "01", "01", "01", "01", "01", "01", "01", "01", "02", "02"],
|
|
@@ -2456,6 +2472,7 @@ Time taken: 0.01 seconds
|
|
|
2456
2472
|
Code to utilize this package and solve the puzzle:
|
|
2457
2473
|
|
|
2458
2474
|
```python
|
|
2475
|
+
import numpy as np
|
|
2459
2476
|
from puzzle_solver import battleships_solver as solver
|
|
2460
2477
|
board = np.array([
|
|
2461
2478
|
[' ', ' ', ' ', ' ', ' ', 'S', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
|
|
@@ -2538,6 +2555,7 @@ The goal is to make some of the cells black in such a way that:
|
|
|
2538
2555
|
Code to utilize this package and solve the puzzle:
|
|
2539
2556
|
|
|
2540
2557
|
```python
|
|
2558
|
+
import numpy as np
|
|
2541
2559
|
from puzzle_solver import kakurasu_solver as solver
|
|
2542
2560
|
side = np.array([27, 6, 1, 12, 37, 37, 11, 4, 29, 23, 66, 55])
|
|
2543
2561
|
bottom = np.array([22, 1, 25, 36, 10, 22, 25, 35, 32, 28, 45, 45])
|
|
@@ -2598,6 +2616,7 @@ Code to utilize this package and solve the puzzle:
|
|
|
2598
2616
|
Note that as usual the board is an id of the shape (id is meaningless, just used to identify one shape), and the `star_count` parameter depenends on the puzzle type.
|
|
2599
2617
|
|
|
2600
2618
|
```python
|
|
2619
|
+
import numpy as np
|
|
2601
2620
|
from puzzle_solver import star_battle_solver as solver
|
|
2602
2621
|
board = np.array([
|
|
2603
2622
|
['00', '00', '00', '00', '00', '01', '01', '01', '01', '01', '01', '01', '01', '01', '02', '02', '02', '03', '03', '03', '03', '03', '03', '03', '03'],
|
|
@@ -2697,7 +2716,8 @@ Code to utilize this package and solve the puzzle:
|
|
|
2697
2716
|
The `star_count` parameter depenends on the puzzle type.
|
|
2698
2717
|
|
|
2699
2718
|
```python
|
|
2700
|
-
|
|
2719
|
+
import numpy as np
|
|
2720
|
+
from puzzle_solver import star_battle_shapeless as solver
|
|
2701
2721
|
board = np.array([
|
|
2702
2722
|
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
|
|
2703
2723
|
['B', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
|
|
@@ -2710,7 +2730,7 @@ board = np.array([
|
|
|
2710
2730
|
['B', 'B', ' ', ' ', ' ', ' ', 'B', 'B', 'B', ' '],
|
|
2711
2731
|
['B', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' '],
|
|
2712
2732
|
])
|
|
2713
|
-
binst =
|
|
2733
|
+
binst = solver.Board(board=board, star_count=2)
|
|
2714
2734
|
solutions = binst.solve_and_print()
|
|
2715
2735
|
```
|
|
2716
2736
|
|
|
@@ -2767,6 +2787,8 @@ Note: The solver is capable of solving variations where the puzzle pieces the ma
|
|
|
2767
2787
|
Code to utilize this package and solve the puzzle:
|
|
2768
2788
|
|
|
2769
2789
|
```python
|
|
2790
|
+
import numpy as np
|
|
2791
|
+
from puzzle_solver import lits_solver as solver
|
|
2770
2792
|
board = np.array([
|
|
2771
2793
|
['00', '00', '00', '01', '01', '02', '02', '02', '03', '03', '03', '04', '04', '05', '06', '07', '07', '08', '08', '09'],
|
|
2772
2794
|
['00', '00', '00', '00', '01', '02', '03', '03', '03', '10', '04', '04', '05', '05', '06', '07', '08', '08', '09', '09'],
|
|
@@ -2963,6 +2985,7 @@ Code to utilize this package and solve the puzzle:
|
|
|
2963
2985
|
Note: The number are arbitrary and simply number each galaxy as an integer.
|
|
2964
2986
|
|
|
2965
2987
|
```python
|
|
2988
|
+
import numpy as np
|
|
2966
2989
|
from puzzle_solver import galaxies_solver as solver
|
|
2967
2990
|
galaxies = np.array([
|
|
2968
2991
|
[' ', ' ', '00', ' ', ' ', '01', '01', '02', '02', '03', '03', ' ', '04', '04', ' '],
|
|
@@ -3047,6 +3070,7 @@ Code to utilize this package and solve the puzzle:
|
|
|
3047
3070
|
Note: For an NxM board you need an (N+1)x(M+1) array because the puzzle is to solve for the cells while the input is the values at the corners (there's always one more corner than cells in each dimension).
|
|
3048
3071
|
|
|
3049
3072
|
```python
|
|
3073
|
+
import numpy as np
|
|
3050
3074
|
from puzzle_solver import slant_solver as solver
|
|
3051
3075
|
board = np.array([
|
|
3052
3076
|
[' ', ' ', '1', ' ', '1', ' ', '1', ' ', '1', ' ', ' ', ' ', ' '],
|
|
@@ -3131,6 +3155,7 @@ Code to utilize this package and solve the puzzle:
|
|
|
3131
3155
|
Note: For an NxM board you need an (2N-1)x(2M-1) array because the puzzle involves input in between the cells. Each numbered cell has neighbors horizontally to represent ">", "<", and "|" (where "|" represents adjacency) and vertically to represent "∧", "∨" and "-" (where "-" represents adjacency). The "X" in the input are unused corners that shouldnt contain anything (just a corner). The numbers should never appear orthogonal to an "X", only diagonally to it. vice-versa for the comparison operators.
|
|
3132
3156
|
|
|
3133
3157
|
```python
|
|
3158
|
+
import numpy as np
|
|
3134
3159
|
from puzzle_solver import unequal_solver as solver
|
|
3135
3160
|
board = np.array([
|
|
3136
3161
|
[' ', ' ', ' ', ' ', '9', ' ', '1', ' ', '7', '>', ' ', '>', ' ', ' ', ' ', ' ', ' ', '>', ' '],
|
|
@@ -3210,6 +3235,7 @@ You have to shade some of the cells in such a way that:
|
|
|
3210
3235
|
Code to utilize this package and solve the puzzle:
|
|
3211
3236
|
|
|
3212
3237
|
```python
|
|
3238
|
+
import numpy as np
|
|
3213
3239
|
from puzzle_solver import norinori_solver as solver
|
|
3214
3240
|
board = np.array([
|
|
3215
3241
|
['00', '01', '01', '01', '01', '02', '03', '03', '04', '04', '04', '05', '05', '05', '06', '07', '08', '08', '09', '09'],
|
|
@@ -3299,6 +3325,7 @@ A line forming a single loop without crossings or branches means that every corn
|
|
|
3299
3325
|
Code to utilize this package and solve the puzzle:
|
|
3300
3326
|
|
|
3301
3327
|
```python
|
|
3328
|
+
import numpy as np
|
|
3302
3329
|
from puzzle_solver import slitherlink_solver as solver
|
|
3303
3330
|
board = np.array([
|
|
3304
3331
|
['3', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' ', '3', ' ', ' ', ' ', ' ', ' ', '3', ' ', ' ', '1', ' '],
|
|
@@ -3385,6 +3412,97 @@ Applying the solution to the puzzle visually:
|
|
|
3385
3412
|
|
|
3386
3413
|
---
|
|
3387
3414
|
|
|
3415
|
+
|
|
3416
|
+
## Yin-Yang (Puzzle Type #40)
|
|
3417
|
+
|
|
3418
|
+
* [**Play online**](https://www.puzzle-yin-yang.com)
|
|
3419
|
+
|
|
3420
|
+
* [**Solver Code**][40]
|
|
3421
|
+
|
|
3422
|
+
<details>
|
|
3423
|
+
<summary><strong>Rules</strong></summary>
|
|
3424
|
+
|
|
3425
|
+
Yin-Yang is played on a rectangular grid with no standard size. Some cells start out filled with black or white. The rest of the cells are empty. The goal is to color all cells in such a way that:
|
|
3426
|
+
1. All black cells should be connected orthogonally in a single group.
|
|
3427
|
+
2. All white cells should be connected orthogonally in a single group.
|
|
3428
|
+
3. 2x2 areas of the same color are not allowed.
|
|
3429
|
+
|
|
3430
|
+
</details>
|
|
3431
|
+
|
|
3432
|
+
**Unsolved puzzle**
|
|
3433
|
+
|
|
3434
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/yin_yang_unsolved.png" alt="Yin-Yang unsolved" width="500">
|
|
3435
|
+
|
|
3436
|
+
Code to utilize this package and solve the puzzle:
|
|
3437
|
+
|
|
3438
|
+
```python
|
|
3439
|
+
import numpy as np
|
|
3440
|
+
from puzzle_solver import yin_yang_solver as solver
|
|
3441
|
+
board = np.array([
|
|
3442
|
+
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
|
|
3443
|
+
[' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', 'B', ' ', ' ', 'W', ' ', 'W', ' ', ' ', 'W', ' ', ' '],
|
|
3444
|
+
[' ', ' ', 'B', ' ', 'B', ' ', 'W', ' ', ' ', 'W', 'B', ' ', ' ', ' ', ' ', 'W', ' ', 'W', ' ', ' '],
|
|
3445
|
+
[' ', ' ', ' ', ' ', ' ', 'W', ' ', 'W', ' ', 'B', ' ', ' ', ' ', ' ', 'W', ' ', ' ', 'W', ' ', ' '],
|
|
3446
|
+
[' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'W', 'W', ' ', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' '],
|
|
3447
|
+
[' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', 'W', 'B', ' ', ' ', ' ', ' ', ' ', 'W', ' ', 'W', ' ', ' '],
|
|
3448
|
+
[' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', ' ', 'B', ' ', 'B', ' ', 'B', 'W', ' ', 'W', ' ', ' '],
|
|
3449
|
+
[' ', ' ', 'B', 'W', 'W', ' ', 'W', ' ', ' ', ' ', 'B', ' ', 'B', ' ', 'B', ' ', ' ', ' ', ' ', ' '],
|
|
3450
|
+
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', 'B', ' ', 'B', ' ', 'B', ' ', 'B', ' ', 'B', ' '],
|
|
3451
|
+
[' ', 'W', ' ', 'W', ' ', ' ', 'W', ' ', ' ', ' ', 'B', ' ', 'B', ' ', 'B', ' ', 'B', ' ', 'B', ' '],
|
|
3452
|
+
[' ', ' ', ' ', ' ', 'W', 'B', ' ', ' ', ' ', 'B', ' ', ' ', 'B', ' ', 'B', ' ', 'B', ' ', 'B', ' '],
|
|
3453
|
+
[' ', ' ', 'B', ' ', ' ', ' ', 'B', 'B', ' ', 'W', 'B', ' ', 'B', ' ', 'B', ' ', ' ', 'B', ' ', ' '],
|
|
3454
|
+
[' ', 'W', 'W', 'W', ' ', 'B', ' ', 'W', ' ', ' ', 'B', ' ', 'B', ' ', 'B', ' ', ' ', ' ', 'B', ' '],
|
|
3455
|
+
[' ', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', 'B', ' ', 'B', ' ', ' ', 'B', ' ', 'B', ' ', 'B', ' '],
|
|
3456
|
+
[' ', 'W', ' ', 'B', 'W', 'B', ' ', 'W', ' ', ' ', ' ', ' ', 'B', 'B', ' ', ' ', 'B', ' ', 'B', ' '],
|
|
3457
|
+
[' ', ' ', ' ', ' ', 'W', ' ', ' ', 'B', 'B', 'B', 'B', 'B', ' ', ' ', ' ', 'B', ' ', ' ', 'B', ' '],
|
|
3458
|
+
[' ', 'W', ' ', ' ', ' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', 'B', ' '],
|
|
3459
|
+
['W', ' ', ' ', 'W', ' ', ' ', 'B', ' ', ' ', 'B', 'B', 'B', 'B', 'B', ' ', ' ', 'B', ' ', 'B', ' '],
|
|
3460
|
+
[' ', 'W', 'W', ' ', 'W', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', 'B', ' ', 'B', ' '],
|
|
3461
|
+
['B', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', 'W']
|
|
3462
|
+
])
|
|
3463
|
+
binst = solver.Board(board=board)
|
|
3464
|
+
solutions = binst.solve_and_print()
|
|
3465
|
+
```
|
|
3466
|
+
|
|
3467
|
+
**Script Output**
|
|
3468
|
+
|
|
3469
|
+
```python
|
|
3470
|
+
Solution found
|
|
3471
|
+
[
|
|
3472
|
+
[ 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W' ],
|
|
3473
|
+
[ 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'B', 'B', 'B', 'B', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W' ],
|
|
3474
|
+
[ 'W', 'W', 'B', 'W', 'B', 'W', 'W', 'W', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W' ],
|
|
3475
|
+
[ 'W', 'B', 'B', 'B', 'B', 'W', 'B', 'W', 'B', 'B', 'B', 'B', 'B', 'B', 'W', 'B', 'B', 'W', 'B', 'W' ],
|
|
3476
|
+
[ 'W', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'W', 'W', 'W', 'W', 'B', 'W', 'W', 'W', 'B', 'W', 'B', 'W' ],
|
|
3477
|
+
[ 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W' ],
|
|
3478
|
+
[ 'W', 'B', 'B', 'B', 'W', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W' ],
|
|
3479
|
+
[ 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W' ],
|
|
3480
|
+
[ 'W', 'B', 'B', 'B', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W' ],
|
|
3481
|
+
[ 'W', 'W', 'W', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W' ],
|
|
3482
|
+
[ 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W' ],
|
|
3483
|
+
[ 'W', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'B', 'W' ],
|
|
3484
|
+
[ 'W', 'W', 'W', 'W', 'W', 'B', 'W', 'W', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'W', 'B', 'W' ],
|
|
3485
|
+
[ 'W', 'B', 'B', 'B', 'B', 'B', 'W', 'B', 'B', 'B', 'B', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W' ],
|
|
3486
|
+
[ 'W', 'W', 'W', 'B', 'W', 'B', 'W', 'W', 'W', 'W', 'W', 'W', 'B', 'B', 'B', 'W', 'B', 'W', 'B', 'W' ],
|
|
3487
|
+
[ 'W', 'B', 'B', 'B', 'W', 'B', 'W', 'B', 'B', 'B', 'B', 'B', 'B', 'W', 'B', 'B', 'B', 'W', 'B', 'W' ],
|
|
3488
|
+
[ 'W', 'W', 'B', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'B', 'W', 'B', 'W' ],
|
|
3489
|
+
[ 'W', 'B', 'B', 'W', 'B', 'B', 'B', 'B', 'W', 'B', 'B', 'B', 'B', 'B', 'B', 'W', 'B', 'W', 'B', 'W' ],
|
|
3490
|
+
[ 'W', 'W', 'W', 'W', 'W', 'W', 'W', 'B', 'W', 'W', 'W', 'W', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'W' ],
|
|
3491
|
+
[ 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'W' ],
|
|
3492
|
+
]
|
|
3493
|
+
Solutions found: 1
|
|
3494
|
+
status: OPTIMAL
|
|
3495
|
+
Time taken: 3.10 seconds
|
|
3496
|
+
```
|
|
3497
|
+
|
|
3498
|
+
**Solved puzzle**
|
|
3499
|
+
|
|
3500
|
+
Applying the solution to the puzzle visually:
|
|
3501
|
+
|
|
3502
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/yin_yang_solved.png" alt="Yin-Yang solved" width="500">
|
|
3503
|
+
|
|
3504
|
+
---
|
|
3505
|
+
|
|
3388
3506
|
---
|
|
3389
3507
|
|
|
3390
3508
|
## Why SAT / CP-SAT?
|
|
@@ -3475,3 +3593,4 @@ Issues and PRs welcome!
|
|
|
3475
3593
|
[37]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/unequal "puzzle_solver/src/puzzle_solver/puzzles/unequal at master · Ar-Kareem/puzzle_solver · GitHub"
|
|
3476
3594
|
[38]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/norinori "puzzle_solver/src/puzzle_solver/puzzles/norinori at master · Ar-Kareem/puzzle_solver · GitHub"
|
|
3477
3595
|
[39]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/slitherlink "puzzle_solver/src/puzzle_solver/puzzles/slitherlink at master · Ar-Kareem/puzzle_solver · GitHub"
|
|
3596
|
+
[40]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/yin_yang "puzzle_solver/src/puzzle_solver/puzzles/yin_yang at master · Ar-Kareem/puzzle_solver · GitHub"
|