multi-puzzle-solver 0.9.22__tar.gz → 0.9.24__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.

Files changed (102) hide show
  1. {multi_puzzle_solver-0.9.22/src/multi_puzzle_solver.egg-info → multi_puzzle_solver-0.9.24}/PKG-INFO +221 -2
  2. multi_puzzle_solver-0.9.22/PKG-INFO → multi_puzzle_solver-0.9.24/README.md +3789 -3596
  3. multi_puzzle_solver-0.9.22/README.md → multi_puzzle_solver-0.9.24/src/multi_puzzle_solver.egg-info/PKG-INFO +3815 -3570
  4. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/multi_puzzle_solver.egg-info/SOURCES.txt +4 -0
  5. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/__init__.py +3 -1
  6. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/core/utils.py +135 -0
  7. multi_puzzle_solver-0.9.24/src/puzzle_solver/puzzles/binairo/binairo.py +98 -0
  8. multi_puzzle_solver-0.9.24/src/puzzle_solver/puzzles/rectangles/rectangles.py +130 -0
  9. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/slitherlink/slitherlink.py +4 -128
  10. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/yin_yang/parse_map/parse_map.py +4 -1
  11. multi_puzzle_solver-0.9.24/tests/test_binairo.py +126 -0
  12. multi_puzzle_solver-0.9.24/tests/test_rectangles.py +127 -0
  13. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/pyproject.toml +0 -0
  14. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/setup.cfg +0 -0
  15. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/multi_puzzle_solver.egg-info/dependency_links.txt +0 -0
  16. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/multi_puzzle_solver.egg-info/requires.txt +0 -0
  17. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/multi_puzzle_solver.egg-info/top_level.txt +0 -0
  18. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/core/utils_ortools.py +0 -0
  19. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/aquarium/aquarium.py +0 -0
  20. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/battleships/battleships.py +0 -0
  21. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/black_box/black_box.py +0 -0
  22. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/bridges/bridges.py +0 -0
  23. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/chess_range/chess_melee.py +0 -0
  24. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/chess_range/chess_range.py +0 -0
  25. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/chess_range/chess_solo.py +0 -0
  26. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/dominosa/dominosa.py +0 -0
  27. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/filling/filling.py +0 -0
  28. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/galaxies/galaxies.py +0 -0
  29. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/galaxies/parse_map/parse_map.py +0 -0
  30. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/guess/guess.py +0 -0
  31. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/inertia/inertia.py +0 -0
  32. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/inertia/parse_map/parse_map.py +0 -0
  33. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/inertia/tsp.py +0 -0
  34. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/kakurasu/kakurasu.py +0 -0
  35. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/keen/keen.py +0 -0
  36. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/light_up/light_up.py +0 -0
  37. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/lits/lits.py +0 -0
  38. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/magnets/magnets.py +0 -0
  39. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/map/map.py +0 -0
  40. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/minesweeper/minesweeper.py +0 -0
  41. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/mosaic/mosaic.py +0 -0
  42. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/nonograms/nonograms.py +0 -0
  43. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/norinori/norinori.py +0 -0
  44. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/pearl/pearl.py +0 -0
  45. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/range/range.py +0 -0
  46. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/signpost/signpost.py +0 -0
  47. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/singles/singles.py +0 -0
  48. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/slant/parse_map/parse_map.py +0 -0
  49. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/slant/slant.py +0 -0
  50. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/star_battle/star_battle.py +0 -0
  51. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/star_battle/star_battle_shapeless.py +0 -0
  52. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/stitches/parse_map/parse_map.py +0 -0
  53. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/stitches/stitches.py +0 -0
  54. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/sudoku/sudoku.py +0 -0
  55. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/tents/tents.py +0 -0
  56. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/thermometers/thermometers.py +0 -0
  57. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/towers/towers.py +0 -0
  58. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/tracks/tracks.py +0 -0
  59. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/undead/undead.py +0 -0
  60. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/unequal/unequal.py +0 -0
  61. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/unruly/unruly.py +0 -0
  62. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/puzzles/yin_yang/yin_yang.py +0 -0
  63. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/src/puzzle_solver/utils/visualizer.py +0 -0
  64. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_aquarium.py +0 -0
  65. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_battleships.py +0 -0
  66. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_black_box.py +0 -0
  67. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_bridges.py +0 -0
  68. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_chess_melee.py +0 -0
  69. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_chess_range.py +0 -0
  70. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_chess_solo.py +0 -0
  71. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_dominosa.py +0 -0
  72. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_filling.py +0 -0
  73. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_galaxies.py +0 -0
  74. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_guess.py +0 -0
  75. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_inertia.py +0 -0
  76. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_kakurasu.py +0 -0
  77. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_keen.py +0 -0
  78. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_light_up.py +0 -0
  79. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_lits.py +0 -0
  80. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_magnets.py +0 -0
  81. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_map.py +0 -0
  82. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_minesweeper.py +0 -0
  83. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_mosaic.py +0 -0
  84. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_nonograms.py +0 -0
  85. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_norinori.py +0 -0
  86. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_pearl.py +0 -0
  87. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_range.py +0 -0
  88. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_signpost.py +0 -0
  89. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_singles.py +0 -0
  90. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_slant.py +0 -0
  91. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_slitherlink.py +0 -0
  92. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_star_battle.py +0 -0
  93. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_stitches.py +0 -0
  94. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_sudoku.py +0 -0
  95. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_tents.py +0 -0
  96. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_thermometers.py +0 -0
  97. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_towers.py +0 -0
  98. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_tracks.py +0 -0
  99. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_undead.py +0 -0
  100. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_unequal.py +0 -0
  101. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_unruly.py +0 -0
  102. {multi_puzzle_solver-0.9.22 → multi_puzzle_solver-0.9.24}/tests/test_yin_yang.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multi-puzzle-solver
3
- Version: 0.9.22
3
+ Version: 0.9.24
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
@@ -315,6 +315,18 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
315
315
  </a>
316
316
  </td>
317
317
  </tr>
318
+ <tr>
319
+ <td align="center">
320
+ <a href="#binairo-puzzle-type-41"><b>Binairo</b><br><br>
321
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/binairo_solved.png" alt="Binairo" width="140">
322
+ </a>
323
+ </td>
324
+ <td align="center">
325
+ <a href="#rectangles-puzzle-type-42"><b>Rectangles</b><br><br>
326
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/rectangles_solved.png" alt="Rectangles" width="140">
327
+ </a>
328
+ </td>
329
+ </tr>
318
330
  </table>
319
331
 
320
332
  </div>
@@ -369,6 +381,8 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
369
381
  - [Norinori (Puzzle Type #38)](#norinori-puzzle-type-38)
370
382
  - [Slitherlink (Puzzle Type #39)](#slitherlink-puzzle-type-39)
371
383
  - [Yin-Yang (Puzzle Type #40)](#yin-yang-puzzle-type-40)
384
+ - [Binairo (Puzzle Type #41)](#binairo-puzzle-type-41)
385
+ - [Rectangles (Puzzle Type #42)](#rectangles-puzzle-type-42)
372
386
  - [Why SAT / CP-SAT?](#why-sat--cp-sat)
373
387
  - [Testing](#testing)
374
388
  - [Contributing](#contributing)
@@ -3412,7 +3426,6 @@ Applying the solution to the puzzle visually:
3412
3426
 
3413
3427
  ---
3414
3428
 
3415
-
3416
3429
  ## Yin-Yang (Puzzle Type #40)
3417
3430
 
3418
3431
  * [**Play online**](https://www.puzzle-yin-yang.com)
@@ -3503,6 +3516,210 @@ Applying the solution to the puzzle visually:
3503
3516
 
3504
3517
  ---
3505
3518
 
3519
+ ## Binairo (Puzzle Type #41)
3520
+
3521
+ * [**Play online**](https://www.puzzle-binairo.com)
3522
+
3523
+ * [**Solver Code**][41]
3524
+
3525
+ <details>
3526
+ <summary><strong>Rules</strong></summary>
3527
+
3528
+ Binairo is played on a rectangular grid with no standard size. Some cells start out filled with black or white circles. The rest of the cells are empty. The goal is to place circles in all cells in such a way that:
3529
+
3530
+ 1. Each row and each column must contain an equal number of white and black circles.
3531
+ 2. More than two circles of the same color can't be adjacent.
3532
+ 3. Each row and column is unique.
3533
+
3534
+ </details>
3535
+
3536
+ **Unsolved puzzle**
3537
+
3538
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/binairo_unsolved.png" alt="Binairo unsolved" width="500">
3539
+
3540
+ Code to utilize this package and solve the puzzle:
3541
+
3542
+ ```python
3543
+ import numpy as np
3544
+ from puzzle_solver import binairo_solver as solver
3545
+ board = np.array([
3546
+ [' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', 'W'],
3547
+ [' ', 'W', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', 'B', ' ', ' ', ' ', 'B', ' '],
3548
+ [' ', 'W', ' ', ' ', ' ', 'W', ' ', 'W', 'W', ' ', ' ', ' ', 'B', ' ', ' ', 'W', ' ', ' ', ' ', ' '],
3549
+ ['B', ' ', ' ', 'W', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
3550
+ ['B', ' ', ' ', ' ', 'W', ' ', ' ', ' ', ' ', 'B', ' ', 'W', ' ', ' ', ' ', 'B', ' ', ' ', ' ', 'W'],
3551
+ [' ', ' ', 'W', ' ', ' ', 'W', ' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' '],
3552
+ ['W', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', 'B', ' ', ' ', 'B', 'B', ' ', ' ', 'W', ' ', 'B', ' '],
3553
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', ' '],
3554
+ [' ', ' ', ' ', ' ', 'W', ' ', 'B', ' ', 'W', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
3555
+ [' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', 'W', 'W', ' ', ' ', ' '],
3556
+ [' ', ' ', 'B', ' ', ' ', ' ', 'B', ' ', 'B', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
3557
+ [' ', 'W', 'B', ' ', 'W', ' ', 'B', ' ', ' ', ' ', ' ', ' ', 'W', 'W', ' ', 'B', ' ', ' ', 'B', ' '],
3558
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', ' ', 'B', 'B'],
3559
+ [' ', 'B', ' ', ' ', ' ', ' ', 'W', ' ', 'W', 'W', ' ', ' ', 'W', ' ', ' ', ' ', 'W', ' ', ' ', ' '],
3560
+ [' ', ' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'W', 'W', ' ', ' ', 'W', 'W', ' '],
3561
+ [' ', 'B', ' ', 'B', 'W', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
3562
+ [' ', 'B', ' ', ' ', ' ', 'W', ' ', ' ', ' ', 'W', ' ', ' ', 'B', ' ', 'B', ' ', ' ', ' ', ' ', ' '],
3563
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', 'W'],
3564
+ [' ', ' ', ' ', 'B', 'B', ' ', ' ', 'W', ' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' '],
3565
+ ['B', ' ', 'B', 'B', ' ', ' ', ' ', ' ', ' ', 'W', ' ', 'B', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ']
3566
+ ])
3567
+ binst = solver.Board(board=board)
3568
+ solutions = binst.solve_and_print()
3569
+ ```
3570
+
3571
+ **Script Output**
3572
+
3573
+ ```python
3574
+ Solution found
3575
+ [
3576
+ [ 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W' ],
3577
+ [ 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W' ],
3578
+ [ 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'B' ],
3579
+ [ 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'B' ],
3580
+ [ 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'W' ],
3581
+ [ 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B' ],
3582
+ [ 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'B', 'W' ],
3583
+ [ 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B' ],
3584
+ [ 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'W' ],
3585
+ [ 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B' ],
3586
+ [ 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'W' ],
3587
+ [ 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W' ],
3588
+ [ 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'B' ],
3589
+ [ 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'W' ],
3590
+ [ 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B' ],
3591
+ [ 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W' ],
3592
+ [ 'W', 'B', 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B' ],
3593
+ [ 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W' ],
3594
+ [ 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B' ],
3595
+ [ 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'W', 'B' ],
3596
+ ]
3597
+ Solutions found: 1
3598
+ status: OPTIMAL
3599
+ Time taken: 0.03 seconds
3600
+ ```
3601
+
3602
+ **Solved puzzle**
3603
+
3604
+ Applying the solution to the puzzle visually:
3605
+
3606
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/binairo_solved.png" alt="Binairo solved" width="500">
3607
+
3608
+ ---
3609
+
3610
+ ## Rectangles (Puzzle Type #42)
3611
+
3612
+ Also called "Shikaku".
3613
+
3614
+ * [**Play online**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/rect.html)
3615
+
3616
+ * [**Instructions**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/doc/rect.html#rect)
3617
+
3618
+ * [**Solver Code**][42]
3619
+
3620
+ <details>
3621
+ <summary><strong>Rules</strong></summary>
3622
+
3623
+ You have a grid of squares, with numbers written in some (but not all) of the squares. Your task is to subdivide the grid into rectangles of various sizes, such that both:
3624
+
3625
+ - (a) every rectangle contains exactly one numbered square
3626
+ - (b) the area of each rectangle is equal to the number written in its numbered square.
3627
+
3628
+
3629
+ </details>
3630
+
3631
+ **Unsolved puzzle**
3632
+
3633
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/rectangles_unsolved.png" alt="Rectangles unsolved" width="500">
3634
+
3635
+ Code to utilize this package and solve the puzzle:
3636
+
3637
+ ```python
3638
+ import numpy as np
3639
+ from puzzle_solver import rectangles_solver as solver
3640
+ board = np.array([
3641
+ ['3', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '15',' ', ' ', ' ', ' ' ],
3642
+ [' ', ' ', '2', '2', ' ', ' ', ' ', ' ', ' ', ' ', '11',' ', ' ', ' ', ' ', ' ', ' ', '3', '2' ],
3643
+ [' ', ' ', ' ', ' ', '2', ' ', ' ', ' ', '11',' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '2', ' ' ],
3644
+ [' ', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' ', ' ', '6', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3645
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '3', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3646
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3647
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3648
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '28','4', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3649
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '10',' ', '10',' ', ' ', ' ', ' ', '45',' ' ],
3650
+ [' ', ' ', '3', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3651
+ [' ', '22',' ', ' ', ' ', ' ', ' ', '28',' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '17'],
3652
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3653
+ [' ', '8', '3', ' ', ' ', '2', '2', ' ', ' ', ' ', '5', ' ', ' ', '4', ' ', ' ', ' ', ' ', ' ' ],
3654
+ [' ', ' ', ' ', ' ', '4', ' ', ' ', '8', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '2', ' ', ' ', ' ' ],
3655
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '3', ' ' ],
3656
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3657
+ ['2', ' ', ' ', ' ', '12',' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3658
+ ['2', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3659
+ [' ', ' ', '3', '2', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '60',' ', ' ', ' ', ' ', ' ', '4', ' ' ],
3660
+ ])
3661
+ binst = solver.Board(board=board)
3662
+ solutions = binst.solve_and_print()
3663
+ ```
3664
+
3665
+ **Script Output**
3666
+
3667
+ ```python
3668
+ Solution found
3669
+ 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
3670
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8
3671
+ ┌───────────┬───────────────────────────────────────────────────────────┬───┐
3672
+ 0│ 3 │ 15 │ │
3673
+ ├───────┬───┼───┬───────────────────────────────────────────┬───────────┤ │
3674
+ 1│ │ 2 │ 2 │ 11 │ 3 │ 2 │
3675
+ │ │ │ ├───┬───────────────────────────────────────┴───┬───────┼───┤
3676
+ 2│ │ │ │ 2 │ 11 │ 2 │ │
3677
+ │ ├───┴───┤ ├───────────────────────┬───┬───┬───────────┴───────┤ │
3678
+ 3│ │ 2 │ │ 6 │ │ │ │ │
3679
+ │ ├───────┴───┴───────────────┬───┬───┤ │ │ │ │
3680
+ 4│ │ │ │ │ 3 │ │ │ │
3681
+ │ │ │ │ │ │ │ │ │
3682
+ 5│ │ │ │ 2 │ │ │ │ │
3683
+ │ │ │ ├───┴───┤ │ │ │
3684
+ 6│ │ │ │ 2 │ │ │ │
3685
+ │ │ │ ├───────┤ │ │ │
3686
+ 7│ │ 28 │ 4 │ │ │ │ │
3687
+ │ ├───┬───────────────────────┴───┤ │ │ │ │
3688
+ 8│ │ │ │10 │10 │ 45 │ │
3689
+ │ │ │ │ │ │ │ │
3690
+ 9│ │ 3 │ │ │ │ │ │
3691
+ │ │ │ │ │ │ │ │
3692
+ 10│ 22 │ │ 28 │ │ │ │17 │
3693
+ │ ├───┤ │ │ │ │ │
3694
+ 11│ │ │ │ │ │ │ │
3695
+ ├───────┤ ├───────┬───┬───┬───────────┴───────┤ ├───────────────┬───┤ │
3696
+ 12│ 8 │ 3 │ │ 2 │ 2 │ 5 │ │ 4 │ │ │
3697
+ │ │ │ │ │ ├───────────────────┴───┴───────┬───────┤ │ │
3698
+ 13│ │ │ 4 │ │ │ 8 │ 2 │ │ │
3699
+ │ ├───┴───────┼───┴───┴───────────────────────────────┴───────┤ │ │
3700
+ 14│ │ │ │ 3 │ │
3701
+ │ │ │ ├───┤ │
3702
+ 15│ │ │ │ │ │
3703
+ ├───────┤ │ │ │ │
3704
+ 16│ 2 │ 12 │ │ │ │
3705
+ ├───────┤ │ │ │ │
3706
+ 17│ 2 │ │ │ │ │
3707
+ ├───────┴───┬───────┤ │ │ │
3708
+ 18│ 3 │ 2 │ 60 │ 4 │ │
3709
+ └───────────┴───────┴───────────────────────────────────────────────┴───┴───┘
3710
+ Solutions found: 1
3711
+ status: OPTIMAL
3712
+ Time taken: 0.01 seconds
3713
+ ```
3714
+
3715
+ **Solved puzzle**
3716
+
3717
+ Applying the solution to the puzzle visually:
3718
+
3719
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/rectangles_solved.png" alt="Rectangles solved" width="500">
3720
+
3721
+ ---
3722
+
3506
3723
  ---
3507
3724
 
3508
3725
  ## Why SAT / CP-SAT?
@@ -3594,3 +3811,5 @@ Issues and PRs welcome!
3594
3811
  [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
3812
  [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
3813
  [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"
3814
+ [41]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/binairo "puzzle_solver/src/puzzle_solver/puzzles/binairo at master · Ar-Kareem/puzzle_solver · GitHub"
3815
+ [42]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/rectangles "puzzle_solver/src/puzzle_solver/puzzles/rectangles at master · Ar-Kareem/puzzle_solver · GitHub"