multi-puzzle-solver 0.9.18__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.18/src/multi_puzzle_solver.egg-info → multi_puzzle_solver-0.9.22}/PKG-INFO +339 -3
- multi_puzzle_solver-0.9.18/PKG-INFO → multi_puzzle_solver-0.9.22/README.md +3570 -3260
- multi_puzzle_solver-0.9.18/README.md → multi_puzzle_solver-0.9.22/src/multi_puzzle_solver.egg-info/PKG-INFO +3596 -3234
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/multi_puzzle_solver.egg-info/SOURCES.txt +8 -1
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/__init__.py +4 -1
- multi_puzzle_solver-0.9.22/src/puzzle_solver/puzzles/norinori/norinori.py +101 -0
- multi_puzzle_solver-0.9.22/src/puzzle_solver/puzzles/slitherlink/slitherlink.py +248 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/stitches/parse_map/parse_map.py +36 -3
- 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_norinori.py +204 -0
- multi_puzzle_solver-0.9.22/tests/test_slitherlink.py +68 -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.18/src/puzzle_solver/puzzles/sudoku/sudoku.py +0 -90
- multi_puzzle_solver-0.9.18/tests/test_sudoku.py +0 -59
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/pyproject.toml +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/setup.cfg +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/multi_puzzle_solver.egg-info/dependency_links.txt +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/multi_puzzle_solver.egg-info/requires.txt +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/multi_puzzle_solver.egg-info/top_level.txt +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/core/utils.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/core/utils_ortools.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/aquarium/aquarium.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/battleships/battleships.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/black_box/black_box.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/bridges/bridges.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/chess_range/chess_melee.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/chess_range/chess_range.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/chess_range/chess_solo.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/dominosa/dominosa.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/filling/filling.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/galaxies/galaxies.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/galaxies/parse_map/parse_map.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/guess/guess.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/inertia/inertia.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/inertia/parse_map/parse_map.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/inertia/tsp.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/kakurasu/kakurasu.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/keen/keen.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/light_up/light_up.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/lits/lits.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/magnets/magnets.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/map/map.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/minesweeper/minesweeper.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/mosaic/mosaic.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/nonograms/nonograms.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/pearl/pearl.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/range/range.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/signpost/signpost.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/singles/singles.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/slant/parse_map/parse_map.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/slant/slant.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/star_battle/star_battle.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/star_battle/star_battle_shapeless.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/stitches/stitches.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/tents/tents.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/thermometers/thermometers.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/towers/towers.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/tracks/tracks.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/undead/undead.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/unequal/unequal.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/puzzles/unruly/unruly.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/src/puzzle_solver/utils/visualizer.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_aquarium.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_battleships.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_black_box.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_bridges.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_chess_melee.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_chess_range.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_chess_solo.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_dominosa.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_filling.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_galaxies.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_guess.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_inertia.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_kakurasu.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_keen.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_light_up.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_lits.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_magnets.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_map.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_minesweeper.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_mosaic.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_nonograms.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_pearl.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_range.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_signpost.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_singles.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_slant.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_star_battle.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_stitches.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_tents.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_thermometers.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_towers.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_tracks.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_undead.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_unequal.py +0 -0
- {multi_puzzle_solver-0.9.18 → multi_puzzle_solver-0.9.22}/tests/test_unruly.py +0 -0
{multi_puzzle_solver-0.9.18/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
|
|
@@ -299,6 +299,21 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
|
|
|
299
299
|
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/unequal_solved.png" alt="Unequal" width="140">
|
|
300
300
|
</a>
|
|
301
301
|
</td>
|
|
302
|
+
<td align="center">
|
|
303
|
+
<a href="#norinori-puzzle-type-38"><b>Norinori</b><br><br>
|
|
304
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/norinori_solved.png" alt="Norinori" width="140">
|
|
305
|
+
</a>
|
|
306
|
+
</td>
|
|
307
|
+
<td align="center">
|
|
308
|
+
<a href="#slitherlink-puzzle-type-39"><b>Slitherlink</b><br><br>
|
|
309
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/slitherlink_solved.png" alt="Slitherlink" width="140">
|
|
310
|
+
</a>
|
|
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>
|
|
302
317
|
</tr>
|
|
303
318
|
</table>
|
|
304
319
|
|
|
@@ -351,6 +366,9 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
|
|
|
351
366
|
- [Galaxies (Puzzle Type #35)](#galaxies-puzzle-type-35)
|
|
352
367
|
- [Slant (Puzzle Type #36)](#slant-puzzle-type-36)
|
|
353
368
|
- [Unequal (Puzzle Type #37)](#unequal-puzzle-type-37)
|
|
369
|
+
- [Norinori (Puzzle Type #38)](#norinori-puzzle-type-38)
|
|
370
|
+
- [Slitherlink (Puzzle Type #39)](#slitherlink-puzzle-type-39)
|
|
371
|
+
- [Yin-Yang (Puzzle Type #40)](#yin-yang-puzzle-type-40)
|
|
354
372
|
- [Why SAT / CP-SAT?](#why-sat--cp-sat)
|
|
355
373
|
- [Testing](#testing)
|
|
356
374
|
- [Contributing](#contributing)
|
|
@@ -476,6 +494,13 @@ You are given some of the numbers as clues; your aim is to place the rest of the
|
|
|
476
494
|
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/sudoku_unsolved.png" alt="Sudoku unsolved" width="500">
|
|
477
495
|
|
|
478
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
|
+
|
|
479
504
|
```python
|
|
480
505
|
import numpy as np
|
|
481
506
|
from puzzle_solver import sudoku_solver as solver
|
|
@@ -2208,6 +2233,7 @@ The numbers outside the grid show the number of filled cells horizontally and ve
|
|
|
2208
2233
|
Code to utilize this package and solve the puzzle:
|
|
2209
2234
|
|
|
2210
2235
|
```python
|
|
2236
|
+
import numpy as np
|
|
2211
2237
|
from puzzle_solver import thermometers_solver as solver
|
|
2212
2238
|
board = np.array([
|
|
2213
2239
|
['R', 'R', 'D', 'R', 'D', 'R', 'X', 'D', 'L', 'X', 'L', 'L', 'L', 'L', 'L'],
|
|
@@ -2287,6 +2313,7 @@ The numbers outside the grid show the number of filled cells horizontally and ve
|
|
|
2287
2313
|
Code to utilize this package and solve the puzzle:
|
|
2288
2314
|
|
|
2289
2315
|
```python
|
|
2316
|
+
import numpy as np
|
|
2290
2317
|
from puzzle_solver import aquarium_solver as solver
|
|
2291
2318
|
board = np.array([
|
|
2292
2319
|
['01', '01', '01', '01', '02', '02', '02', '03', '03', '03', '03', '04', '05', '05', '05'],
|
|
@@ -2364,6 +2391,7 @@ Time taken: 0.02 seconds
|
|
|
2364
2391
|
Code to utilize this package and solve the puzzle:
|
|
2365
2392
|
|
|
2366
2393
|
```python
|
|
2394
|
+
import numpy as np
|
|
2367
2395
|
from puzzle_solver import stitches_solver as solver
|
|
2368
2396
|
board = np.array([
|
|
2369
2397
|
["00", "00", "00", "00", "00", "01", "01", "01", "01", "01", "01", "01", "01", "02", "02"],
|
|
@@ -2444,6 +2472,7 @@ Time taken: 0.01 seconds
|
|
|
2444
2472
|
Code to utilize this package and solve the puzzle:
|
|
2445
2473
|
|
|
2446
2474
|
```python
|
|
2475
|
+
import numpy as np
|
|
2447
2476
|
from puzzle_solver import battleships_solver as solver
|
|
2448
2477
|
board = np.array([
|
|
2449
2478
|
[' ', ' ', ' ', ' ', ' ', 'S', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
|
|
@@ -2526,6 +2555,7 @@ The goal is to make some of the cells black in such a way that:
|
|
|
2526
2555
|
Code to utilize this package and solve the puzzle:
|
|
2527
2556
|
|
|
2528
2557
|
```python
|
|
2558
|
+
import numpy as np
|
|
2529
2559
|
from puzzle_solver import kakurasu_solver as solver
|
|
2530
2560
|
side = np.array([27, 6, 1, 12, 37, 37, 11, 4, 29, 23, 66, 55])
|
|
2531
2561
|
bottom = np.array([22, 1, 25, 36, 10, 22, 25, 35, 32, 28, 45, 45])
|
|
@@ -2586,6 +2616,7 @@ Code to utilize this package and solve the puzzle:
|
|
|
2586
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.
|
|
2587
2617
|
|
|
2588
2618
|
```python
|
|
2619
|
+
import numpy as np
|
|
2589
2620
|
from puzzle_solver import star_battle_solver as solver
|
|
2590
2621
|
board = np.array([
|
|
2591
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'],
|
|
@@ -2685,7 +2716,8 @@ Code to utilize this package and solve the puzzle:
|
|
|
2685
2716
|
The `star_count` parameter depenends on the puzzle type.
|
|
2686
2717
|
|
|
2687
2718
|
```python
|
|
2688
|
-
|
|
2719
|
+
import numpy as np
|
|
2720
|
+
from puzzle_solver import star_battle_shapeless as solver
|
|
2689
2721
|
board = np.array([
|
|
2690
2722
|
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
|
|
2691
2723
|
['B', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
|
|
@@ -2698,7 +2730,7 @@ board = np.array([
|
|
|
2698
2730
|
['B', 'B', ' ', ' ', ' ', ' ', 'B', 'B', 'B', ' '],
|
|
2699
2731
|
['B', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' '],
|
|
2700
2732
|
])
|
|
2701
|
-
binst =
|
|
2733
|
+
binst = solver.Board(board=board, star_count=2)
|
|
2702
2734
|
solutions = binst.solve_and_print()
|
|
2703
2735
|
```
|
|
2704
2736
|
|
|
@@ -2755,6 +2787,8 @@ Note: The solver is capable of solving variations where the puzzle pieces the ma
|
|
|
2755
2787
|
Code to utilize this package and solve the puzzle:
|
|
2756
2788
|
|
|
2757
2789
|
```python
|
|
2790
|
+
import numpy as np
|
|
2791
|
+
from puzzle_solver import lits_solver as solver
|
|
2758
2792
|
board = np.array([
|
|
2759
2793
|
['00', '00', '00', '01', '01', '02', '02', '02', '03', '03', '03', '04', '04', '05', '06', '07', '07', '08', '08', '09'],
|
|
2760
2794
|
['00', '00', '00', '00', '01', '02', '03', '03', '03', '10', '04', '04', '05', '05', '06', '07', '08', '08', '09', '09'],
|
|
@@ -2951,6 +2985,7 @@ Code to utilize this package and solve the puzzle:
|
|
|
2951
2985
|
Note: The number are arbitrary and simply number each galaxy as an integer.
|
|
2952
2986
|
|
|
2953
2987
|
```python
|
|
2988
|
+
import numpy as np
|
|
2954
2989
|
from puzzle_solver import galaxies_solver as solver
|
|
2955
2990
|
galaxies = np.array([
|
|
2956
2991
|
[' ', ' ', '00', ' ', ' ', '01', '01', '02', '02', '03', '03', ' ', '04', '04', ' '],
|
|
@@ -3035,6 +3070,7 @@ Code to utilize this package and solve the puzzle:
|
|
|
3035
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).
|
|
3036
3071
|
|
|
3037
3072
|
```python
|
|
3073
|
+
import numpy as np
|
|
3038
3074
|
from puzzle_solver import slant_solver as solver
|
|
3039
3075
|
board = np.array([
|
|
3040
3076
|
[' ', ' ', '1', ' ', '1', ' ', '1', ' ', '1', ' ', ' ', ' ', ' '],
|
|
@@ -3083,6 +3119,8 @@ Applying the solution to the puzzle visually:
|
|
|
3083
3119
|
|
|
3084
3120
|
## Unequal (Puzzle Type #37)
|
|
3085
3121
|
|
|
3122
|
+
Also called "Futoshiki" or Renzoku"
|
|
3123
|
+
|
|
3086
3124
|
* [**Play online**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/unequal.html)
|
|
3087
3125
|
|
|
3088
3126
|
* [**Instructions**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/doc/unequal.html#unequal)
|
|
@@ -3117,6 +3155,8 @@ Code to utilize this package and solve the puzzle:
|
|
|
3117
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.
|
|
3118
3156
|
|
|
3119
3157
|
```python
|
|
3158
|
+
import numpy as np
|
|
3159
|
+
from puzzle_solver import unequal_solver as solver
|
|
3120
3160
|
board = np.array([
|
|
3121
3161
|
[' ', ' ', ' ', ' ', '9', ' ', '1', ' ', '7', '>', ' ', '>', ' ', ' ', ' ', ' ', ' ', '>', ' '],
|
|
3122
3162
|
[' ', 'X', 'V', 'X', ' ', 'X', ' ', 'X', ' ', 'X', ' ', 'X', '∧', 'X', ' ', 'X', ' ', 'X', ' '],
|
|
@@ -3170,6 +3210,299 @@ Applying the solution to the puzzle visually:
|
|
|
3170
3210
|
|
|
3171
3211
|
---
|
|
3172
3212
|
|
|
3213
|
+
## Norinori (Puzzle Type #38)
|
|
3214
|
+
|
|
3215
|
+
* [**Play online**](https://www.puzzle-norinori.com)
|
|
3216
|
+
|
|
3217
|
+
* [**Solver Code**][38]
|
|
3218
|
+
|
|
3219
|
+
<details>
|
|
3220
|
+
<summary><strong>Rules</strong></summary>
|
|
3221
|
+
|
|
3222
|
+
You have to shade some of the cells in such a way that:
|
|
3223
|
+
- Exactly 2 cells are shaded in each region.
|
|
3224
|
+
- Each shaded cell should be a part of a domino*. Dominoes can cross the region borders.
|
|
3225
|
+
- The dominoes cannot touch each other except diagonally.
|
|
3226
|
+
|
|
3227
|
+
* A domino is a shape made of 2 shaded cells next to each other (1x2 or 2x1).
|
|
3228
|
+
|
|
3229
|
+
</details>
|
|
3230
|
+
|
|
3231
|
+
**Unsolved puzzle**
|
|
3232
|
+
|
|
3233
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/norinori_unsolved.png" alt="Norinori unsolved" width="500">
|
|
3234
|
+
|
|
3235
|
+
Code to utilize this package and solve the puzzle:
|
|
3236
|
+
|
|
3237
|
+
```python
|
|
3238
|
+
import numpy as np
|
|
3239
|
+
from puzzle_solver import norinori_solver as solver
|
|
3240
|
+
board = np.array([
|
|
3241
|
+
['00', '01', '01', '01', '01', '02', '03', '03', '04', '04', '04', '05', '05', '05', '06', '07', '08', '08', '09', '09'],
|
|
3242
|
+
['00', '00', '01', '01', '01', '02', '03', '04', '04', '10', '11', '11', '05', '06', '06', '07', '08', '08', '12', '12'],
|
|
3243
|
+
['13', '13', '13', '01', '01', '03', '03', '10', '10', '10', '11', '14', '05', '14', '07', '07', '07', '12', '12', '12'],
|
|
3244
|
+
['13', '15', '13', '16', '16', '16', '17', '17', '17', '18', '18', '14', '14', '14', '07', '07', '07', '07', '07', '12'],
|
|
3245
|
+
['13', '15', '15', '16', '19', '19', '17', '17', '17', '18', '18', '18', '14', '20', '07', '07', '21', '21', '21', '21'],
|
|
3246
|
+
['13', '19', '19', '19', '19', '19', '17', '22', '22', '22', '22', '18', '14', '20', '20', '07', '21', '23', '23', '21'],
|
|
3247
|
+
['24', '24', '25', '25', '25', '25', '26', '27', '27', '27', '28', '28', '20', '20', '29', '29', '30', '30', '31', '31'],
|
|
3248
|
+
['24', '24', '25', '32', '33', '33', '26', '27', '27', '34', '28', '35', '35', '36', '36', '29', '37', '30', '31', '31'],
|
|
3249
|
+
['38', '32', '32', '32', '33', '27', '27', '27', '27', '34', '28', '28', '35', '35', '29', '29', '37', '37', '31', '37'],
|
|
3250
|
+
['38', '38', '32', '39', '33', '40', '34', '34', '34', '34', '28', '35', '35', '35', '41', '37', '37', '37', '37', '37'],
|
|
3251
|
+
['42', '38', '39', '39', '40', '40', '43', '43', '34', '44', '28', '35', '45', '45', '41', '41', '41', '41', '46', '46'],
|
|
3252
|
+
['42', '42', '39', '47', '47', '40', '40', '44', '44', '44', '48', '48', '48', '48', '48', '41', '49', '49', '49', '46'],
|
|
3253
|
+
['50', '50', '39', '39', '40', '40', '40', '40', '51', '51', '51', '52', '48', '48', '53', '41', '54', '54', '49', '46'],
|
|
3254
|
+
['50', '39', '39', '55', '55', '40', '40', '40', '56', '51', '51', '52', '53', '48', '53', '41', '41', '54', '49', '46'],
|
|
3255
|
+
['39', '39', '39', '57', '56', '56', '56', '56', '56', '56', '53', '53', '53', '53', '53', '58', '58', '58', '59', '59'],
|
|
3256
|
+
['60', '39', '39', '57', '57', '61', '61', '61', '62', '56', '56', '63', '63', '63', '63', '63', '59', '59', '59', '59'],
|
|
3257
|
+
['60', '64', '65', '65', '61', '61', '66', '66', '62', '62', '62', '67', '63', '63', '68', '69', '69', '69', '69', '69'],
|
|
3258
|
+
['60', '64', '65', '65', '65', '65', '66', '70', '70', '70', '70', '67', '67', '71', '68', '69', '72', '73', '73', '69'],
|
|
3259
|
+
['60', '60', '60', '65', '66', '66', '66', '66', '74', '75', '75', '75', '67', '71', '68', '68', '72', '73', '73', '73'],
|
|
3260
|
+
['76', '76', '76', '76', '76', '77', '77', '74', '74', '74', '74', '67', '67', '71', '71', '71', '72', '73', '78', '78']
|
|
3261
|
+
])
|
|
3262
|
+
binst = solver.Board(board=board)
|
|
3263
|
+
solutions = binst.solve_and_print()
|
|
3264
|
+
```
|
|
3265
|
+
**Script Output**
|
|
3266
|
+
|
|
3267
|
+
```python
|
|
3268
|
+
Solution found
|
|
3269
|
+
[
|
|
3270
|
+
[ 'X', ' ', ' ', ' ', ' ', 'X', ' ', 'X', ' ', 'X', ' ', 'X', ' ', ' ', 'X', ' ', 'X', ' ', 'X', 'X' ],
|
|
3271
|
+
[ 'X', ' ', 'X', ' ', ' ', 'X', ' ', 'X', ' ', 'X', ' ', 'X', ' ', ' ', 'X', ' ', 'X', ' ', ' ', ' ' ],
|
|
3272
|
+
[ ' ', ' ', 'X', ' ', 'X', ' ', 'X', ' ', 'X', ' ', 'X', ' ', 'X', 'X', ' ', ' ', ' ', 'X', ' ', ' ' ],
|
|
3273
|
+
[ 'X', 'X', ' ', ' ', 'X', ' ', 'X', ' ', 'X', ' ', 'X', ' ', ' ', ' ', ' ', ' ', ' ', 'X', ' ', 'X' ],
|
|
3274
|
+
[ ' ', ' ', 'X', 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X', 'X', ' ', ' ', 'X', 'X', ' ', ' ', 'X' ],
|
|
3275
|
+
[ ' ', 'X', ' ', ' ', 'X', ' ', ' ', 'X', 'X', ' ', ' ', ' ', ' ', 'X', 'X', ' ', ' ', 'X', 'X', ' ' ],
|
|
3276
|
+
[ ' ', 'X', ' ', ' ', 'X', ' ', 'X', ' ', ' ', 'X', ' ', 'X', ' ', ' ', ' ', 'X', 'X', ' ', ' ', 'X' ],
|
|
3277
|
+
[ 'X', ' ', 'X', 'X', ' ', ' ', 'X', ' ', ' ', 'X', ' ', 'X', ' ', 'X', 'X', ' ', ' ', 'X', ' ', 'X' ],
|
|
3278
|
+
[ 'X', ' ', ' ', ' ', 'X', ' ', ' ', ' ', 'X', ' ', ' ', ' ', ' ', ' ', ' ', 'X', ' ', 'X', ' ', ' ' ],
|
|
3279
|
+
[ ' ', 'X', 'X', ' ', 'X', ' ', ' ', ' ', 'X', ' ', 'X', 'X', ' ', ' ', ' ', 'X', ' ', ' ', ' ', ' ' ],
|
|
3280
|
+
[ 'X', ' ', ' ', ' ', ' ', ' ', 'X', 'X', ' ', 'X', ' ', ' ', 'X', 'X', ' ', ' ', ' ', 'X', 'X', ' ' ],
|
|
3281
|
+
[ 'X', ' ', ' ', 'X', 'X', ' ', ' ', ' ', ' ', 'X', ' ', ' ', ' ', ' ', 'X', ' ', 'X', ' ', ' ', ' ' ],
|
|
3282
|
+
[ ' ', 'X', 'X', ' ', ' ', ' ', ' ', 'X', 'X', ' ', ' ', 'X', ' ', ' ', 'X', ' ', 'X', ' ', 'X', 'X' ],
|
|
3283
|
+
[ 'X', ' ', ' ', 'X', 'X', ' ', 'X', ' ', ' ', 'X', ' ', 'X', ' ', 'X', ' ', 'X', ' ', 'X', ' ', ' ' ],
|
|
3284
|
+
[ 'X', ' ', ' ', ' ', ' ', ' ', 'X', ' ', ' ', 'X', ' ', ' ', ' ', 'X', ' ', 'X', ' ', 'X', ' ', ' ' ],
|
|
3285
|
+
[ ' ', ' ', ' ', 'X', 'X', ' ', ' ', 'X', 'X', ' ', ' ', 'X', ' ', ' ', 'X', ' ', 'X', ' ', ' ', 'X' ],
|
|
3286
|
+
[ ' ', 'X', ' ', ' ', ' ', 'X', 'X', ' ', ' ', 'X', ' ', 'X', ' ', ' ', 'X', ' ', 'X', ' ', ' ', 'X' ],
|
|
3287
|
+
[ ' ', 'X', ' ', 'X', 'X', ' ', ' ', 'X', ' ', 'X', ' ', ' ', 'X', 'X', ' ', ' ', ' ', 'X', 'X', ' ' ],
|
|
3288
|
+
[ 'X', ' ', 'X', ' ', ' ', ' ', ' ', 'X', ' ', ' ', 'X', 'X', ' ', ' ', 'X', ' ', 'X', ' ', ' ', ' ' ],
|
|
3289
|
+
[ 'X', ' ', 'X', ' ', ' ', 'X', 'X', ' ', 'X', 'X', ' ', ' ', ' ', ' ', 'X', ' ', 'X', ' ', 'X', 'X' ],
|
|
3290
|
+
]
|
|
3291
|
+
Solutions found: 1
|
|
3292
|
+
status: OPTIMAL
|
|
3293
|
+
Time taken: 0.04 seconds
|
|
3294
|
+
```
|
|
3295
|
+
|
|
3296
|
+
**Solved puzzle**
|
|
3297
|
+
|
|
3298
|
+
Applying the solution to the puzzle visually:
|
|
3299
|
+
|
|
3300
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/norinori_solved.png" alt="Norinori solved" width="500">
|
|
3301
|
+
|
|
3302
|
+
---
|
|
3303
|
+
|
|
3304
|
+
## Slitherlink (Puzzle Type #39)
|
|
3305
|
+
|
|
3306
|
+
Also known as Fences and Loop the Loop
|
|
3307
|
+
|
|
3308
|
+
* [**Play online**](https://www.puzzle-loop.com)
|
|
3309
|
+
|
|
3310
|
+
* [**Solver Code**][39]
|
|
3311
|
+
|
|
3312
|
+
<details>
|
|
3313
|
+
<summary><strong>Rules</strong></summary>
|
|
3314
|
+
|
|
3315
|
+
You have to draw lines between the dots to form a single loop without crossings or branches. The numbers indicate how many lines surround it.
|
|
3316
|
+
|
|
3317
|
+
A line forming a single loop without crossings or branches means that every corner has either 2 or 0 lines touching it.
|
|
3318
|
+
|
|
3319
|
+
</details>
|
|
3320
|
+
|
|
3321
|
+
**Unsolved puzzle**
|
|
3322
|
+
|
|
3323
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/slitherlink_unsolved.png" alt="Slitherlink unsolved" width="500">
|
|
3324
|
+
|
|
3325
|
+
Code to utilize this package and solve the puzzle:
|
|
3326
|
+
|
|
3327
|
+
```python
|
|
3328
|
+
import numpy as np
|
|
3329
|
+
from puzzle_solver import slitherlink_solver as solver
|
|
3330
|
+
board = np.array([
|
|
3331
|
+
['3', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' ', '3', ' ', ' ', ' ', ' ', ' ', '3', ' ', ' ', '1', ' '],
|
|
3332
|
+
[' ', ' ', '3', ' ', '3', ' ', ' ', ' ', '3', ' ', '2', '2', ' ', '2', ' ', '2', '2', ' ', '2', '3'],
|
|
3333
|
+
['2', '2', ' ', ' ', ' ', '2', '1', ' ', '1', '1', ' ', ' ', '3', '1', ' ', '2', ' ', ' ', ' ', '2'],
|
|
3334
|
+
[' ', ' ', '2', ' ', ' ', '2', '2', ' ', ' ', ' ', '3', ' ', ' ', ' ', ' ', ' ', '2', '2', '3', ' '],
|
|
3335
|
+
['1', '2', '1', ' ', ' ', ' ', '2', '1', ' ', '3', '2', ' ', '3', '2', '2', '3', ' ', '3', '2', '2'],
|
|
3336
|
+
[' ', '3', '2', '2', '1', '2', ' ', '3', ' ', ' ', ' ', ' ', '2', '2', '3', ' ', '1', '1', ' ', '2'],
|
|
3337
|
+
['1', ' ', ' ', ' ', ' ', ' ', '2', ' ', ' ', '2', ' ', '1', '3', ' ', ' ', ' ', ' ', '2', '2', '2'],
|
|
3338
|
+
[' ', '3', ' ', '2', '0', '1', '2', '1', ' ', '1', '3', ' ', '2', ' ', ' ', '2', ' ', '2', '1', ' '],
|
|
3339
|
+
['2', ' ', ' ', ' ', '2', ' ', '3', ' ', ' ', ' ', ' ', '2', ' ', ' ', '1', '2', ' ', ' ', '1', '3'],
|
|
3340
|
+
[' ', ' ', '1', ' ', ' ', ' ', ' ', '2', '0', ' ', '1', ' ', '2', ' ', '0', ' ', '2', ' ', '3', '2'],
|
|
3341
|
+
[' ', '3', ' ', '3', ' ', '1', '3', ' ', '3', ' ', '2', ' ', ' ', '2', '2', '2', '3', ' ', ' ', ' '],
|
|
3342
|
+
['3', ' ', ' ', ' ', ' ', ' ', ' ', '0', '2', '1', ' ', ' ', '2', ' ', ' ', '1', ' ', '0', '2', ' '],
|
|
3343
|
+
[' ', ' ', ' ', ' ', ' ', ' ', '3', ' ', '3', '2', '3', ' ', ' ', '2', ' ', '1', ' ', ' ', ' ', ' '],
|
|
3344
|
+
['2', '2', ' ', '3', '0', ' ', ' ', '3', ' ', ' ', '2', ' ', ' ', ' ', ' ', '2', '2', ' ', '3', ' '],
|
|
3345
|
+
[' ', '2', '0', ' ', ' ', '3', ' ', '1', ' ', ' ', '2', ' ', '2', '2', ' ', ' ', ' ', '2', ' ', '2'],
|
|
3346
|
+
[' ', ' ', '1', '3', '1', ' ', ' ', ' ', ' ', ' ', '2', ' ', '2', '1', ' ', '1', '2', '2', ' ', ' '],
|
|
3347
|
+
['2', ' ', '2', '2', ' ', '1', '3', ' ', '2', ' ', '3', '1', '2', ' ', '3', '2', ' ', '1', '1', ' '],
|
|
3348
|
+
[' ', ' ', '2', ' ', '1', ' ', ' ', ' ', '2', ' ', ' ', ' ', '2', ' ', '1', '0', ' ', ' ', ' ', '3'],
|
|
3349
|
+
[' ', '2', ' ', ' ', '2', ' ', '2', '3', '2', ' ', '2', '2', ' ', '3', '2', '2', '3', '3', '1', ' '],
|
|
3350
|
+
['0', '0', ' ', '3', '2', ' ', ' ', ' ', ' ', ' ', '2', '1', '2', '1', ' ', ' ', ' ', '2', '1', ' '],
|
|
3351
|
+
])
|
|
3352
|
+
binst = solver.Board(board=board)
|
|
3353
|
+
solutions = binst.solve_and_print()
|
|
3354
|
+
```
|
|
3355
|
+
**Script Output**
|
|
3356
|
+
|
|
3357
|
+
```python
|
|
3358
|
+
Solution found
|
|
3359
|
+
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
|
|
3360
|
+
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
|
|
3361
|
+
┌───┐ ┌───────┐ ┌───────────────────┐ ┌───────┐ ┌───┐ ┌───────────┐
|
|
3362
|
+
0│ 3 │ · │ · 2 │ · │ · · · · 3 │ · · │ · · │ · │ 3 │ · │ · 1 · │
|
|
3363
|
+
│ │ └───┐ │ │ ┌───────┐ ┌───┘ ┌───┘ ┌───┘ │ │ └───┐ ┌───┘
|
|
3364
|
+
1│ · │ · 3 │ · │ 3 │ · │ · · │ 3 │ · 2 │ 2 · │ 2 · │ 2 │ 2 · │ 2 │ 3
|
|
3365
|
+
│ │ ┌───┘ └───┘ │ └───┘ ┌───┘ ┌───┘ │ └───────┘ └───┐
|
|
3366
|
+
2│ 2 │ 2 │ · · · 2 │ 1 · 1 1 │ · · │ 3 1 · │ 2 · · · 2 │
|
|
3367
|
+
│ │ │ ┌───────────┘ ┌───┐ └───┐ └───────┐ └───────┐ ┌───┐ │
|
|
3368
|
+
3│ · │ · │ 2 │ · · 2 2 │ · │ · · 3 │ · · · │ · · 2 │ 2 │ 3 │ · │
|
|
3369
|
+
│ └───┘ └───────────────┘ └───┐ ┌───┘ ┌───┐ │ ┌───┐ │ │ │ │
|
|
3370
|
+
4│ 1 2 1 · · · 2 1 · │ 3 │ 2 · │ 3 │ 2 │ 2 │ 3 │ · │ 3 │ 2 │ 2 │
|
|
3371
|
+
│ ┌───────────────────────────┐ └───┘ ┌───┘ │ │ │ │ └───┘ │ │
|
|
3372
|
+
5│ · │ 3 2 2 1 2 · 3 │ · · · │ · 2 │ 2 │ 3 │ · │ 1 1 · │ 2 │
|
|
3373
|
+
│ └───────────┐ ┌───────────┘ ┌───────┘ ┌───┘ └───┘ │ ┌───┘ │
|
|
3374
|
+
6│ 1 · · · │ · │ · 2 · · │ 2 · 1 │ 3 · · · │ · 2 │ 2 2 │
|
|
3375
|
+
│ ┌───────────┘ └───────────────┘ ┌───┐ └───────────┐ └───────┘ ┌───┘
|
|
3376
|
+
7│ · │ 3 · 2 0 1 2 1 · 1 │ 3 │ · 2 · · │ 2 · 2 1 │ ·
|
|
3377
|
+
│ └───┐ ┌───┐ ┌───┐ ┌───┐ │ └───────────┐ └───┐ ┌───┐ └───┐
|
|
3378
|
+
8│ 2 · │ · │ · │ 2 · │ 3 │ · │ · │ · │ · 2 · · │ 1 2 │ · │ · │ 1 3 │
|
|
3379
|
+
└───┐ └───┘ └───┐ │ └───┘ └───┘ ┌───┐ ┌───┘ └───┘ │ ┌───┘
|
|
3380
|
+
9 · │ · 1 · · │ · │ · 2 0 · 1 │ · │ 2 │ · 0 · 2 · │ 3 │ 2
|
|
3381
|
+
└───┐ ┌───────┘ │ ┌───┐ ┌───┐ │ │ │ ┌───────┐ └───┘
|
|
3382
|
+
10 · 3 │ · │ 3 · 1 │ 3 │ · │ 3 │ · │ 2 │ · │ · │ 2 2 │ 2 3 │ · · ·
|
|
3383
|
+
┌───────┘ └───────┐ └───┘ └───┘ │ │ │ └───────┘ ┌───┘ ┌───┐
|
|
3384
|
+
11│ 3 · · · · │ · · 0 2 1 │ · │ · │ 2 · · 1 │ · 0 2 │ · │
|
|
3385
|
+
└───┐ ┌───────┐ │ ┌───┐ ┌───┐ │ │ └───┐ ┌───┐ └───┐ ┌───┘ │
|
|
3386
|
+
12 · │ · │ · · │ · │ · │ 3 │ · │ 3 │ 2 │ 3 │ · · │ 2 │ · │ 1 · │ · │ · · │
|
|
3387
|
+
┌───┘ │ ┌───┘ └───┘ │ │ │ └───┘ ┌───┘ │ │ ┌───┘ └───┐ │
|
|
3388
|
+
13│ 2 2 │ · │ 3 0 · · │ 3 │ · │ · 2 · │ · · │ · │ 2 │ 2 · 3 │ · │
|
|
3389
|
+
│ ┌───┘ └───┐ ┌───┐ └───┘ └───────────┘ ┌───┘ │ │ ┌───────┘ │
|
|
3390
|
+
14│ · │ 2 0 · │ · │ 3 │ · 1 · · 2 · 2 │ 2 · │ · │ · │ 2 · 2 │
|
|
3391
|
+
│ │ ┌───┘ │ │ ┌───────────────────┘ └───┘ │ ┌───────┘
|
|
3392
|
+
15│ · │ · 1 │ 3 1 │ · │ · · │ · · 2 · 2 1 · 1 2 │ 2 │ · ·
|
|
3393
|
+
│ └───┐ └───┐ │ └───┐ │ ┌───────────────────┐ ┌───┘ └───────┐
|
|
3394
|
+
16│ 2 · │ 2 2 │ · │ 1 3 │ · │ 2 · │ 3 1 2 · 3 │ 2 │ · 1 1 · │
|
|
3395
|
+
└───┐ └───┐ └───┘ ┌───┘ └───┐ └───┐ ┌───────────┘ └───────┐ ┌───┘
|
|
3396
|
+
17 · │ · 2 │ · 1 · │ · · 2 │ · · │ · │ 2 · 1 0 · · │ · │ 3
|
|
3397
|
+
└───┐ └───┐ ┌───┘ ┌───┐ │ │ │ ┌───┐ ┌───┐ │ └───┐
|
|
3398
|
+
18 · 2 │ · · │ 2 │ · 2 │ 3 │ 2 │ · 2 │ 2 │ · │ 3 │ 2 2 │ 3 │ 3 │ 1 · │
|
|
3399
|
+
└───┐ │ │ ┌───┘ │ └───────┘ └───┘ └───────┘ └───┘ │
|
|
3400
|
+
19 0 0 · │ 3 │ 2 │ · │ · · │ · · 2 1 2 1 · · · 2 1 · │
|
|
3401
|
+
└───┘ └───┘ └───────────────────────────────────────────────┘
|
|
3402
|
+
Solutions found: 1
|
|
3403
|
+
status: OPTIMAL
|
|
3404
|
+
Time taken: 2.39 seconds
|
|
3405
|
+
```
|
|
3406
|
+
|
|
3407
|
+
**Solved puzzle**
|
|
3408
|
+
|
|
3409
|
+
Applying the solution to the puzzle visually:
|
|
3410
|
+
|
|
3411
|
+
<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/slitherlink_solved.png" alt="Slitherlink solved" width="500">
|
|
3412
|
+
|
|
3413
|
+
---
|
|
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
|
+
|
|
3173
3506
|
---
|
|
3174
3507
|
|
|
3175
3508
|
## Why SAT / CP-SAT?
|
|
@@ -3258,3 +3591,6 @@ Issues and PRs welcome!
|
|
|
3258
3591
|
[35]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/galaxies "puzzle_solver/src/puzzle_solver/puzzles/galaxies at master · Ar-Kareem/puzzle_solver · GitHub"
|
|
3259
3592
|
[36]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/slant "puzzle_solver/src/puzzle_solver/puzzles/slant at master · Ar-Kareem/puzzle_solver · GitHub"
|
|
3260
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"
|
|
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"
|
|
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"
|