multi-puzzle-solver 0.9.22__py3-none-any.whl → 0.9.25__py3-none-any.whl

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.

@@ -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.25
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,23 @@ 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
+ <td align="center">
330
+ <a href="#palisade-puzzle-type-43"><b>Palisade</b><br><br>
331
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/palisade_solved.png" alt="Palisade" width="140">
332
+ </a>
333
+ </td>
334
+ </tr>
318
335
  </table>
319
336
 
320
337
  </div>
@@ -369,6 +386,9 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
369
386
  - [Norinori (Puzzle Type #38)](#norinori-puzzle-type-38)
370
387
  - [Slitherlink (Puzzle Type #39)](#slitherlink-puzzle-type-39)
371
388
  - [Yin-Yang (Puzzle Type #40)](#yin-yang-puzzle-type-40)
389
+ - [Binairo (Puzzle Type #41)](#binairo-puzzle-type-41)
390
+ - [Rectangles (Puzzle Type #42)](#rectangles-puzzle-type-42)
391
+ - [Palisade (Puzzle Type #43)](#palisade-puzzle-type-43)
372
392
  - [Why SAT / CP-SAT?](#why-sat--cp-sat)
373
393
  - [Testing](#testing)
374
394
  - [Contributing](#contributing)
@@ -3303,9 +3323,13 @@ Applying the solution to the puzzle visually:
3303
3323
 
3304
3324
  ## Slitherlink (Puzzle Type #39)
3305
3325
 
3306
- Also known as Fences and Loop the Loop
3326
+ Also known as Fences, Loop the Loop, and Loopy
3327
+
3328
+ * [**Play online 1**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/loopy.html)
3329
+
3330
+ * [**Play online 2**](https://www.puzzle-loop.com)
3307
3331
 
3308
- * [**Play online**](https://www.puzzle-loop.com)
3332
+ * [**Instructions**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/doc/loopy.html#loopy)
3309
3333
 
3310
3334
  * [**Solver Code**][39]
3311
3335
 
@@ -3412,7 +3436,6 @@ Applying the solution to the puzzle visually:
3412
3436
 
3413
3437
  ---
3414
3438
 
3415
-
3416
3439
  ## Yin-Yang (Puzzle Type #40)
3417
3440
 
3418
3441
  * [**Play online**](https://www.puzzle-yin-yang.com)
@@ -3503,6 +3526,299 @@ Applying the solution to the puzzle visually:
3503
3526
 
3504
3527
  ---
3505
3528
 
3529
+ ## Binairo (Puzzle Type #41)
3530
+
3531
+ * [**Play online**](https://www.puzzle-binairo.com)
3532
+
3533
+ * [**Solver Code**][41]
3534
+
3535
+ <details>
3536
+ <summary><strong>Rules</strong></summary>
3537
+
3538
+ 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:
3539
+
3540
+ 1. Each row and each column must contain an equal number of white and black circles.
3541
+ 2. More than two circles of the same color can't be adjacent.
3542
+ 3. Each row and column is unique.
3543
+
3544
+ </details>
3545
+
3546
+ **Unsolved puzzle**
3547
+
3548
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/binairo_unsolved.png" alt="Binairo unsolved" width="500">
3549
+
3550
+ Code to utilize this package and solve the puzzle:
3551
+
3552
+ ```python
3553
+ import numpy as np
3554
+ from puzzle_solver import binairo_solver as solver
3555
+ board = np.array([
3556
+ [' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', 'W'],
3557
+ [' ', 'W', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', 'B', ' ', ' ', ' ', 'B', ' '],
3558
+ [' ', 'W', ' ', ' ', ' ', 'W', ' ', 'W', 'W', ' ', ' ', ' ', 'B', ' ', ' ', 'W', ' ', ' ', ' ', ' '],
3559
+ ['B', ' ', ' ', 'W', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
3560
+ ['B', ' ', ' ', ' ', 'W', ' ', ' ', ' ', ' ', 'B', ' ', 'W', ' ', ' ', ' ', 'B', ' ', ' ', ' ', 'W'],
3561
+ [' ', ' ', 'W', ' ', ' ', 'W', ' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' '],
3562
+ ['W', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', 'B', ' ', ' ', 'B', 'B', ' ', ' ', 'W', ' ', 'B', ' '],
3563
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', ' '],
3564
+ [' ', ' ', ' ', ' ', 'W', ' ', 'B', ' ', 'W', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
3565
+ [' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', 'W', 'W', ' ', ' ', ' '],
3566
+ [' ', ' ', 'B', ' ', ' ', ' ', 'B', ' ', 'B', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
3567
+ [' ', 'W', 'B', ' ', 'W', ' ', 'B', ' ', ' ', ' ', ' ', ' ', 'W', 'W', ' ', 'B', ' ', ' ', 'B', ' '],
3568
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', ' ', 'B', 'B'],
3569
+ [' ', 'B', ' ', ' ', ' ', ' ', 'W', ' ', 'W', 'W', ' ', ' ', 'W', ' ', ' ', ' ', 'W', ' ', ' ', ' '],
3570
+ [' ', ' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'W', 'W', ' ', ' ', 'W', 'W', ' '],
3571
+ [' ', 'B', ' ', 'B', 'W', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
3572
+ [' ', 'B', ' ', ' ', ' ', 'W', ' ', ' ', ' ', 'W', ' ', ' ', 'B', ' ', 'B', ' ', ' ', ' ', ' ', ' '],
3573
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', 'W', ' ', ' ', ' ', 'W'],
3574
+ [' ', ' ', ' ', 'B', 'B', ' ', ' ', 'W', ' ', 'W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' ', ' '],
3575
+ ['B', ' ', 'B', 'B', ' ', ' ', ' ', ' ', ' ', 'W', ' ', 'B', ' ', ' ', 'B', ' ', ' ', ' ', ' ', ' ']
3576
+ ])
3577
+ binst = solver.Board(board=board)
3578
+ solutions = binst.solve_and_print()
3579
+ ```
3580
+
3581
+ **Script Output**
3582
+
3583
+ ```python
3584
+ Solution found
3585
+ [
3586
+ [ 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W' ],
3587
+ [ 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W' ],
3588
+ [ 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'B' ],
3589
+ [ 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'B' ],
3590
+ [ 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'W' ],
3591
+ [ 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B' ],
3592
+ [ 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'B', 'W' ],
3593
+ [ 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B' ],
3594
+ [ 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'W' ],
3595
+ [ 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B' ],
3596
+ [ 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'W' ],
3597
+ [ 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W' ],
3598
+ [ 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'B' ],
3599
+ [ 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'W' ],
3600
+ [ 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B' ],
3601
+ [ 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W' ],
3602
+ [ 'W', 'B', 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B' ],
3603
+ [ 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'B', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W' ],
3604
+ [ 'W', 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B', 'W', 'B' ],
3605
+ [ 'B', 'W', 'B', 'B', 'W', 'B', 'W', 'B', 'W', 'W', 'B', 'B', 'W', 'W', 'B', 'W', 'B', 'W', 'W', 'B' ],
3606
+ ]
3607
+ Solutions found: 1
3608
+ status: OPTIMAL
3609
+ Time taken: 0.03 seconds
3610
+ ```
3611
+
3612
+ **Solved puzzle**
3613
+
3614
+ Applying the solution to the puzzle visually:
3615
+
3616
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/binairo_solved.png" alt="Binairo solved" width="500">
3617
+
3618
+ ---
3619
+
3620
+ ## Rectangles (Puzzle Type #42)
3621
+
3622
+ Also called "Shikaku".
3623
+
3624
+ * [**Play online**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/rect.html)
3625
+
3626
+ * [**Instructions**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/doc/rect.html#rect)
3627
+
3628
+ * [**Solver Code**][42]
3629
+
3630
+ <details>
3631
+ <summary><strong>Rules</strong></summary>
3632
+
3633
+ 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:
3634
+
3635
+ - (a) every rectangle contains exactly one numbered square
3636
+ - (b) the area of each rectangle is equal to the number written in its numbered square.
3637
+
3638
+
3639
+ </details>
3640
+
3641
+ **Unsolved puzzle**
3642
+
3643
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/rectangles_unsolved.png" alt="Rectangles unsolved" width="500">
3644
+
3645
+ Code to utilize this package and solve the puzzle:
3646
+
3647
+ ```python
3648
+ import numpy as np
3649
+ from puzzle_solver import rectangles_solver as solver
3650
+ board = np.array([
3651
+ ['3', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '15',' ', ' ', ' ', ' ' ],
3652
+ [' ', ' ', '2', '2', ' ', ' ', ' ', ' ', ' ', ' ', '11',' ', ' ', ' ', ' ', ' ', ' ', '3', '2' ],
3653
+ [' ', ' ', ' ', ' ', '2', ' ', ' ', ' ', '11',' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '2', ' ' ],
3654
+ [' ', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' ', ' ', '6', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3655
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '3', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3656
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3657
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3658
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '28','4', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3659
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '10',' ', '10',' ', ' ', ' ', ' ', '45',' ' ],
3660
+ [' ', ' ', '3', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3661
+ [' ', '22',' ', ' ', ' ', ' ', ' ', '28',' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '17'],
3662
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3663
+ [' ', '8', '3', ' ', ' ', '2', '2', ' ', ' ', ' ', '5', ' ', ' ', '4', ' ', ' ', ' ', ' ', ' ' ],
3664
+ [' ', ' ', ' ', ' ', '4', ' ', ' ', '8', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '2', ' ', ' ', ' ' ],
3665
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '3', ' ' ],
3666
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3667
+ ['2', ' ', ' ', ' ', '12',' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3668
+ ['2', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ],
3669
+ [' ', ' ', '3', '2', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '60',' ', ' ', ' ', ' ', ' ', '4', ' ' ],
3670
+ ])
3671
+ binst = solver.Board(board=board)
3672
+ solutions = binst.solve_and_print()
3673
+ ```
3674
+
3675
+ **Script Output**
3676
+
3677
+ ```python
3678
+ Solution found
3679
+ 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
3680
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8
3681
+ ┌───────────┬───────────────────────────────────────────────────────────┬───┐
3682
+ 0│ 3 │ 15 │ │
3683
+ ├───────┬───┼───┬───────────────────────────────────────────┬───────────┤ │
3684
+ 1│ │ 2 │ 2 │ 11 │ 3 │ 2 │
3685
+ │ │ │ ├───┬───────────────────────────────────────┴───┬───────┼───┤
3686
+ 2│ │ │ │ 2 │ 11 │ 2 │ │
3687
+ │ ├───┴───┤ ├───────────────────────┬───┬───┬───────────┴───────┤ │
3688
+ 3│ │ 2 │ │ 6 │ │ │ │ │
3689
+ │ ├───────┴───┴───────────────┬───┬───┤ │ │ │ │
3690
+ 4│ │ │ │ │ 3 │ │ │ │
3691
+ │ │ │ │ │ │ │ │ │
3692
+ 5│ │ │ │ 2 │ │ │ │ │
3693
+ │ │ │ ├───┴───┤ │ │ │
3694
+ 6│ │ │ │ 2 │ │ │ │
3695
+ │ │ │ ├───────┤ │ │ │
3696
+ 7│ │ 28 │ 4 │ │ │ │ │
3697
+ │ ├───┬───────────────────────┴───┤ │ │ │ │
3698
+ 8│ │ │ │10 │10 │ 45 │ │
3699
+ │ │ │ │ │ │ │ │
3700
+ 9│ │ 3 │ │ │ │ │ │
3701
+ │ │ │ │ │ │ │ │
3702
+ 10│ 22 │ │ 28 │ │ │ │17 │
3703
+ │ ├───┤ │ │ │ │ │
3704
+ 11│ │ │ │ │ │ │ │
3705
+ ├───────┤ ├───────┬───┬───┬───────────┴───────┤ ├───────────────┬───┤ │
3706
+ 12│ 8 │ 3 │ │ 2 │ 2 │ 5 │ │ 4 │ │ │
3707
+ │ │ │ │ │ ├───────────────────┴───┴───────┬───────┤ │ │
3708
+ 13│ │ │ 4 │ │ │ 8 │ 2 │ │ │
3709
+ │ ├───┴───────┼───┴───┴───────────────────────────────┴───────┤ │ │
3710
+ 14│ │ │ │ 3 │ │
3711
+ │ │ │ ├───┤ │
3712
+ 15│ │ │ │ │ │
3713
+ ├───────┤ │ │ │ │
3714
+ 16│ 2 │ 12 │ │ │ │
3715
+ ├───────┤ │ │ │ │
3716
+ 17│ 2 │ │ │ │ │
3717
+ ├───────┴───┬───────┤ │ │ │
3718
+ 18│ 3 │ 2 │ 60 │ 4 │ │
3719
+ └───────────┴───────┴───────────────────────────────────────────────┴───┴───┘
3720
+ Solutions found: 1
3721
+ status: OPTIMAL
3722
+ Time taken: 0.01 seconds
3723
+ ```
3724
+
3725
+ **Solved puzzle**
3726
+
3727
+ Applying the solution to the puzzle visually:
3728
+
3729
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/rectangles_solved.png" alt="Rectangles solved" width="500">
3730
+
3731
+ ---
3732
+
3733
+
3734
+ ## Palisade (Puzzle Type #43)
3735
+
3736
+ * [**Play online**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/palisade.html)
3737
+
3738
+ * [**Instructions**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/doc/palisade.html#palisade)
3739
+
3740
+ * [**Solver Code**][42]
3741
+
3742
+ <details>
3743
+ <summary><strong>Rules</strong></summary>
3744
+
3745
+ You're given a grid of N squares and a region size M, some of which contain numbers. Your goal is to subdivide the grid into (N/M) contiguous regions, where every region is of size M, such that each square containing a number is adjacent to exactly that many edges (including those between the inside and the outside of the grid).
3746
+
3747
+ </details>
3748
+
3749
+ **Unsolved puzzle**
3750
+
3751
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/palisade_unsolved.png" alt="Palisade unsolved" width="500">
3752
+
3753
+ Code to utilize this package and solve the puzzle:
3754
+
3755
+ (Note: it takes a few seconds for the model to be built if the region size is larger than 8 and around 10 seconds for a region size of 10)
3756
+
3757
+ ```python
3758
+ import numpy as np
3759
+ from puzzle_solver import palisade_solver as solver
3760
+ board = np.array([
3761
+ ['2', ' ', ' ', ' ', ' ', '3', ' ', ' ', '1', '1', '3', ' ', ' ', ' ', ' '],
3762
+ ['3', '2', '1', ' ', '2', '3', ' ', ' ', ' ', ' ', ' ', '2', ' ', '0', ' '],
3763
+ [' ', ' ', ' ', '1', '1', ' ', ' ', '1', ' ', ' ', ' ', '1', ' ', ' ', ' '],
3764
+ [' ', '3', '2', ' ', ' ', ' ', ' ', '2', '3', ' ', ' ', ' ', '1', ' ', ' '],
3765
+ [' ', '0', '1', ' ', '2', ' ', ' ', '0', ' ', ' ', ' ', '1', ' ', '3', '2'],
3766
+ ['1', '0', ' ', ' ', ' ', '2', '2', ' ', '2', ' ', '3', ' ', '0', '2', ' '],
3767
+ [' ', ' ', ' ', ' ', ' ', '3', ' ', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' '],
3768
+ [' ', '1', ' ', ' ', ' ', '3', '1', ' ', '1', ' ', ' ', ' ', ' ', '1', ' '],
3769
+ [' ', ' ', ' ', '0', ' ', ' ', '0', ' ', ' ', '1', '2', ' ', ' ', ' ', '3'],
3770
+ [' ', ' ', ' ', ' ', ' ', ' ', '1', ' ', ' ', '2', ' ', ' ', '1', '2', '1'],
3771
+ [' ', ' ', ' ', ' ', '1', ' ', '2', '3', '1', ' ', ' ', ' ', '2', ' ', '1'],
3772
+ ['2', ' ', '1', ' ', '2', '2', '1', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' '],
3773
+ ])
3774
+ binst = solver.Board(board, region_size=10)
3775
+ solutions = binst.solve_and_print()
3776
+ ```
3777
+
3778
+ **Script Output**
3779
+
3780
+ ```python
3781
+ Solution found
3782
+ 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
3783
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
3784
+ ┌───────────────────┬───────────────────────┬───────────────┐
3785
+ 0│ 2 · · · · │ 3 · · 1 1 3 │ · · · · │
3786
+ │ ┌───────────┐ ├───────┬───┐ ┌───┴───┐ │
3787
+ 1│ 3 │ 2 1 · │ 2 │ 3 · │ · │ · · │ · 2 │ · 0 · │
3788
+ ├───┘ │ └───┐ │ └───┐ └───┐ └───┐ │
3789
+ 2│ · · · 1 │ 1 · │ · │ 1 · │ · · │ 1 · │ · · │
3790
+ │ ┌───┐ │ ┌───┘ │ ┌───┴───────┘ └───┐ │
3791
+ 3│ · │ 3 │ 2 · │ · │ · · │ 2 │ 3 · · · 1 · │ · │
3792
+ ├───┘ └───────┼───┘ ┌───┘ └───┬───────────────┬───┴───┤
3793
+ 4│ · 0 1 · │ 2 · │ · 0 · │ · · 1 · │ 3 2 │
3794
+ │ ┌───┘ │ │ ┌───┐ └───┐ │
3795
+ 5│ 1 0 · │ · · 2 │ 2 · 2 │ · │ 3 │ · 0 2 │ · │
3796
+ │ ┌───┴───────────┼───┬───────┴───┤ ├───┐ │ │
3797
+ 6│ · · │ · · · 3 │ · │ · · 2 │ · │ · │ · · │ · │
3798
+ ├───────┘ ┌───────────┤ └───┐ │ │ └───────┘ │
3799
+ 7│ · 1 · │ · · 3 │ 1 · │ 1 · │ · │ · · 1 · │
3800
+ │ ┌───┘ ┌───┘ │ │ └───────┐ ┌───┤
3801
+ 8│ · · │ · 0 · │ · 0 · │ · 1 │ 2 · · │ · │ 3 │
3802
+ │ ┌───┘ ┌───┤ ├───┐ └───┐ ├───┘ │
3803
+ 9│ · │ · · · │ · │ · 1 · │ · │ 2 · │ · 1 │ 2 1 │
3804
+ ├───┤ ┌───────┘ ├───────┐ │ └───┐ │ │ │
3805
+ 10│ · │ · │ · · 1 │ · 2 │ 3 │ 1 · │ · │ · 2 │ · 1 │
3806
+ │ └───┘ │ └───┘ ├───┴───────┘ │
3807
+ 11│ 2 · 1 · 2 │ 2 1 · · 2 │ · · · · · │
3808
+ └───────────────────┴───────────────────┴───────────────────┘
3809
+ Solutions found: 1
3810
+ status: OPTIMAL
3811
+ Time taken: 11.94 seconds
3812
+ ```
3813
+
3814
+ **Solved puzzle**
3815
+
3816
+ Applying the solution to the puzzle visually:
3817
+
3818
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/palisade_solved.png" alt="Palisade solved" width="500">
3819
+
3820
+ ---
3821
+
3506
3822
  ---
3507
3823
 
3508
3824
  ## Why SAT / CP-SAT?
@@ -3594,3 +3910,6 @@ Issues and PRs welcome!
3594
3910
  [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
3911
  [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
3912
  [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"
3913
+ [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"
3914
+ [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"
3915
+ [43]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/palisade "puzzle_solver/src/puzzle_solver/puzzles/palisade at master · Ar-Kareem/puzzle_solver · GitHub"
@@ -1,8 +1,9 @@
1
- puzzle_solver/__init__.py,sha256=H7Tpw9yF9TDqwck6bXv1jiS9TGtO5nsVwcDd0Fp1Xyg,2926
2
- puzzle_solver/core/utils.py,sha256=_LA81kHrsgvqPvq7RISBeaurXmYMKAU9N6qmV8n0G7s,8063
3
- puzzle_solver/core/utils_ortools.py,sha256=2xEL9cMEKmNhRD9lhr2nGdZ3Lbmc9cnHY8xv6iLhUr0,10542
1
+ puzzle_solver/__init__.py,sha256=DsQVO-Eo1odFFFvQB1IpbJw-Yr2MTtON6zMnLUi05P8,3203
2
+ puzzle_solver/core/utils.py,sha256=7Wo8_LHLEv8bY5-HsuCuLIjttZMMW09DoL1CcFDiu1Q,14046
3
+ puzzle_solver/core/utils_ortools.py,sha256=_i8cixHOB5XGqqcr-493bOiZgYJidnvxQMEfj--Trns,10278
4
4
  puzzle_solver/puzzles/aquarium/aquarium.py,sha256=BUfkAS2d9eG3TdMoe1cOGGeNYgKUebRvn-z9nsC9gvE,5708
5
5
  puzzle_solver/puzzles/battleships/battleships.py,sha256=RuYCrs4j0vUjlU139NRYYP-uNPAgO0V7hAzbsHrRwD8,7446
6
+ puzzle_solver/puzzles/binairo/binairo.py,sha256=sRtflnlGrN8xQ64beRZBGr74R8KptzxYDdFgXuW27pM,4595
6
7
  puzzle_solver/puzzles/black_box/black_box.py,sha256=ZnHDVt6PFS_r1kMNSsbz9hav1hxIrNDUvPyERGPjLjM,15635
7
8
  puzzle_solver/puzzles/bridges/bridges.py,sha256=15A9uV4xjoqPRo_9CTnoKeGRxS3z2aMF619T1n0dTOQ,5402
8
9
  puzzle_solver/puzzles/chess_range/chess_melee.py,sha256=D-_Oi8OyxsVe1j3dIKYwRlxgeb3NWLmDWGcv-oclY0c,195
@@ -11,6 +12,7 @@ puzzle_solver/puzzles/chess_range/chess_solo.py,sha256=U3v766UsZHx_dC3gxqU90VbjA
11
12
  puzzle_solver/puzzles/chess_sequence/chess_sequence.py,sha256=6ap3Wouf2PxHV4P56B9ol1QT98Ym6VHaxorQZWl6LnY,13692
12
13
  puzzle_solver/puzzles/dominosa/dominosa.py,sha256=Nmb7pn8U27QJwGy9F3wo8ylqo2_U51OAo3GN2soaNpc,7195
13
14
  puzzle_solver/puzzles/filling/filling.py,sha256=vrOIil285_r3IQ0F4c9mUBWMRVlPH4vowog_z1tCGdI,5567
15
+ puzzle_solver/puzzles/flip/flip.py,sha256=4rQ-JsC_f33YKDM7aueKVlcVdDwzeBkTJL51K-Vy0gA,2223
14
16
  puzzle_solver/puzzles/galaxies/galaxies.py,sha256=p10lpmW0FjtneFCMEjG1FSiEpQuvD8zZG9FG8zYGoes,5582
15
17
  puzzle_solver/puzzles/galaxies/parse_map/parse_map.py,sha256=v5TCrdREeOB69s9_QFgPHKA7flG69Im1HVzIdxH0qQc,9355
16
18
  puzzle_solver/puzzles/guess/guess.py,sha256=sH-NlYhxM3DNbhk4eGde09kgM0KaDvSbLrpHQiwcFGo,10791
@@ -20,20 +22,22 @@ puzzle_solver/puzzles/inertia/parse_map/parse_map.py,sha256=A9JQTNqamUdzlwqks0XQ
20
22
  puzzle_solver/puzzles/kakurasu/kakurasu.py,sha256=VNGMJnBHDi6WkghLObRLhUvkmrPaGphTTUDMC0TkQvQ,2064
21
23
  puzzle_solver/puzzles/keen/keen.py,sha256=tDb6C5S3Q0JAKPsdw-84WQ6PxRADELZHr_BK8FDH-NA,5039
22
24
  puzzle_solver/puzzles/light_up/light_up.py,sha256=iSA1rjZMFsnI0V0Nxivxox4qZkB7PvUrROSHXcoUXds,4541
23
- puzzle_solver/puzzles/lits/lits.py,sha256=6Yp9EqhQpuWz_rc_rXtu9dG_pUrmBAhWj1Q9IyAfxPk,7891
25
+ puzzle_solver/puzzles/lits/lits.py,sha256=3fPIkhAIUz8JokcfaE_ZM3b0AFEnf5xPzGJ2qnm8SWY,7099
24
26
  puzzle_solver/puzzles/magnets/magnets.py,sha256=-Wl49JD_PKeq735zQVMQ3XSQX6gdHiY-7PKw-Sh16jw,6474
25
27
  puzzle_solver/puzzles/map/map.py,sha256=sxc57tapB8Tsgam-yoDitln1o-EB_SbIYvO6WEYy3us,2582
26
28
  puzzle_solver/puzzles/minesweeper/minesweeper.py,sha256=LiQVOGkWCsc1WtX8CdPgL_WwAcaeUFuoi5_eqH8U2Og,5876
27
29
  puzzle_solver/puzzles/mosaic/mosaic.py,sha256=QX_nVpVKQg8OfaUcqFk9tKqsDyVqvZc6-XWvfI3YcSw,2175
28
30
  puzzle_solver/puzzles/nonograms/nonograms.py,sha256=1jmDTOCnmivmBlwtMDyyk3TVqH5IjapzLn7zLQ4qubk,6056
29
31
  puzzle_solver/puzzles/norinori/norinori.py,sha256=uC8vXAw35xsTmpmTeKqYW7tbcssms9LCcXFBONtV2Ng,4743
32
+ puzzle_solver/puzzles/palisade/palisade.py,sha256=ZFvBnBVbR0iIcQ5Vm3PtHPjdSDvrO5OUbM91YoTKpHI,4962
30
33
  puzzle_solver/puzzles/pearl/pearl.py,sha256=OhzpMYpxqvR3GCd5NH4ETT0NO4X753kRi6p5omYLChM,6798
31
34
  puzzle_solver/puzzles/range/range.py,sha256=rruvD5ZSaOgvQuX6uGV_Dkr82nSiWZ5kDz03_j7Tt24,4425
35
+ puzzle_solver/puzzles/rectangles/rectangles.py,sha256=V7p6GSCwYrFfILDWiLLUbX08WlnPbQKdhQm8bMa2Mgw,7060
32
36
  puzzle_solver/puzzles/signpost/signpost.py,sha256=-0_S6ycwzwlUf9-ZhP127Rgo5gMBOHiTM6t08dLLDac,3869
33
37
  puzzle_solver/puzzles/singles/singles.py,sha256=3wACiUa1Vmh2ce6szQ2hPjyBuH7aHiQ888p4R2jFkW4,3342
34
38
  puzzle_solver/puzzles/slant/slant.py,sha256=xF-N4PuXYfx638NP1f1mi6YncIZB4mLtXtdS79XyPbg,6122
35
39
  puzzle_solver/puzzles/slant/parse_map/parse_map.py,sha256=dxnALSDXe9wU0uSD0QEXnzoh1q801mj1ePTNLtG0n60,4796
36
- puzzle_solver/puzzles/slitherlink/slitherlink.py,sha256=jw-Buwzo_eZADL45zD5-Hs8HaT3AU4dZn6eifCUPnhA,11701
40
+ puzzle_solver/puzzles/slitherlink/slitherlink.py,sha256=N3jv1Z-yYFlQDinii-DZfuJvLUsn9fT0h5Kyruxjn94,7017
37
41
  puzzle_solver/puzzles/star_battle/star_battle.py,sha256=IX6w4H3sifN01kPPtrAVRCK0Nl_xlXXSHvJKw8K1EuE,3718
38
42
  puzzle_solver/puzzles/star_battle/star_battle_shapeless.py,sha256=lj05V0Y3A3NjMo1boMkPIwBhMtm6SWydjgAMeCf5EIo,225
39
43
  puzzle_solver/puzzles/stitches/stitches.py,sha256=iK8t02q43gH3FPbuIDn4dK0sbaOgZOnw8yHNRNvNuIU,6534
@@ -47,9 +51,9 @@ puzzle_solver/puzzles/undead/undead.py,sha256=IrCUfzQFBem658P5KKqldG7vd2TugTHehc
47
51
  puzzle_solver/puzzles/unequal/unequal.py,sha256=ExY2XDCrqROCDpRLfHo8uVr1zuli1QvbCdNCiDhlCac,6978
48
52
  puzzle_solver/puzzles/unruly/unruly.py,sha256=sDF0oKT50G-NshyW2DYrvAgD9q9Ku9ANUyNhGSAu7cQ,3827
49
53
  puzzle_solver/puzzles/yin_yang/yin_yang.py,sha256=WrRdNhmKhIARdGOt_36gpRxRzrfLGv3wl7igBpPFM64,5259
50
- puzzle_solver/puzzles/yin_yang/parse_map/parse_map.py,sha256=l4b6eO30kspmiP20b60WbvxEEKNKgLQU1SgwDNhhLOA,6459
54
+ puzzle_solver/puzzles/yin_yang/parse_map/parse_map.py,sha256=drjfoHqmFf6U-ZQUwrBbfGINRxDQpgbvy4U3D9QyMhM,6617
51
55
  puzzle_solver/utils/visualizer.py,sha256=tsX1yEKwmwXBYuBJpx_oZGe2UUt1g5yV73G3UbtmvtE,6817
52
- multi_puzzle_solver-0.9.22.dist-info/METADATA,sha256=X8hwi1PYI_Yka0rUuxUy5vck0_lSHt-Gwy0m1w8tS_k,187121
53
- multi_puzzle_solver-0.9.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
54
- multi_puzzle_solver-0.9.22.dist-info/top_level.txt,sha256=exwVUQa-anK9vYrpKzBPvH8bX43iElWI4VeNiAyBGJY,14
55
- multi_puzzle_solver-0.9.22.dist-info/RECORD,,
56
+ multi_puzzle_solver-0.9.25.dist-info/METADATA,sha256=DcVaQpmwyhYN0y0XxOcvomrpoerVjgYdylE8VUFml04,208538
57
+ multi_puzzle_solver-0.9.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
+ multi_puzzle_solver-0.9.25.dist-info/top_level.txt,sha256=exwVUQa-anK9vYrpKzBPvH8bX43iElWI4VeNiAyBGJY,14
59
+ multi_puzzle_solver-0.9.25.dist-info/RECORD,,
puzzle_solver/__init__.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from puzzle_solver.puzzles.aquarium import aquarium as aquarium_solver
2
2
  from puzzle_solver.puzzles.battleships import battleships as battleships_solver
3
+ from puzzle_solver.puzzles.binairo import binairo as binairo_solver
3
4
  from puzzle_solver.puzzles.black_box import black_box as black_box_solver
4
5
  from puzzle_solver.puzzles.bridges import bridges as bridges_solver
5
6
  from puzzle_solver.puzzles.chess_range import chess_range as chess_range_solver
@@ -7,6 +8,7 @@ from puzzle_solver.puzzles.chess_range import chess_solo as chess_solo_solver
7
8
  from puzzle_solver.puzzles.chess_range import chess_melee as chess_melee_solver
8
9
  from puzzle_solver.puzzles.dominosa import dominosa as dominosa_solver
9
10
  from puzzle_solver.puzzles.filling import filling as filling_solver
11
+ # from puzzle_solver.puzzles.flip import flip as flip_solver
10
12
  from puzzle_solver.puzzles.galaxies import galaxies as galaxies_solver
11
13
  from puzzle_solver.puzzles.guess import guess as guess_solver
12
14
  from puzzle_solver.puzzles.inertia import inertia as inertia_solver
@@ -19,9 +21,11 @@ from puzzle_solver.puzzles.minesweeper import minesweeper as minesweeper_solver
19
21
  from puzzle_solver.puzzles.mosaic import mosaic as mosaic_solver
20
22
  from puzzle_solver.puzzles.nonograms import nonograms as nonograms_solver
21
23
  from puzzle_solver.puzzles.norinori import norinori as norinori_solver
24
+ from puzzle_solver.puzzles.palisade import palisade as palisade_solver
22
25
  from puzzle_solver.puzzles.lits import lits as lits_solver
23
26
  from puzzle_solver.puzzles.pearl import pearl as pearl_solver
24
27
  from puzzle_solver.puzzles.range import range as range_solver
28
+ from puzzle_solver.puzzles.rectangles import rectangles as rectangles_solver
25
29
  from puzzle_solver.puzzles.signpost import signpost as signpost_solver
26
30
  from puzzle_solver.puzzles.singles import singles as singles_solver
27
31
  from puzzle_solver.puzzles.slant import slant as slant_solver
@@ -41,4 +45,4 @@ from puzzle_solver.puzzles.yin_yang import yin_yang as yin_yang_solver
41
45
 
42
46
  from puzzle_solver.puzzles.inertia.parse_map.parse_map import main as inertia_image_parser
43
47
 
44
- __version__ = '0.9.22'
48
+ __version__ = '0.9.25'