multi-puzzle-solver 0.9.5__py3-none-any.whl → 0.9.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multi-puzzle-solver
3
- Version: 0.9.5
3
+ Version: 0.9.7
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
@@ -242,6 +242,18 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
242
242
  <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/battleships_solved.png" alt="Battleships" width="140">
243
243
  </a>
244
244
  </td>
245
+ <td align="center">
246
+ <a href="#kakurasu-puzzle-type-30"><b>Kakurasu</b><br><br>
247
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/kakurasu_solved.png" alt="Kakurasu" width="140">
248
+ </a>
249
+ </td>
250
+ </tr>
251
+ <tr>
252
+ <td align="center">
253
+ <a href="#star-battle-puzzle-type-31"><b>Star Battle</b><br><br>
254
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/star_battle_unsolved.png" alt="Star Battle" width="140">
255
+ </a>
256
+ </td>
245
257
  </tr>
246
258
  </table>
247
259
 
@@ -286,6 +298,8 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
286
298
  - [Aquarium (Puzzle Type #27)](#aquarium-puzzle-type-27)
287
299
  - [Stitches (Puzzle Type #28)](#stitches-puzzle-type-28)
288
300
  - [Battleships (Puzzle Type #29)](#battleships-puzzle-type-29)
301
+ - [Kakurasu (Puzzle Type #30)](#kakurasu-puzzle-type-30)
302
+ - [Star Battle (Puzzle Type #31)](#star-battle-puzzle-type-31)
289
303
  - [Why SAT / CP-SAT?](#why-sat--cp-sat)
290
304
  - [Testing](#testing)
291
305
  - [Contributing](#contributing)
@@ -2439,6 +2453,165 @@ Time taken: 0.12 seconds
2439
2453
 
2440
2454
  ---
2441
2455
 
2456
+ ## Kakurasu (Puzzle Type #30)
2457
+
2458
+ * [**Play online**](https://www.puzzle-kakurasu.com/)
2459
+
2460
+ * [**Solver Code**][30]
2461
+
2462
+ <details>
2463
+ <summary><strong>Rules</strong></summary>
2464
+
2465
+ The goal is to make some of the cells black in such a way that:
2466
+
2467
+ 1. The black cells on each row sum up to the number on the right.
2468
+
2469
+ 2. The black cells on each column sum up to the number on the bottom.
2470
+
2471
+ 3. If a black cell is first on its row/column its value is 1. If it is second its value is 2 etc.
2472
+
2473
+ </details>
2474
+
2475
+ **Unsolved puzzle**
2476
+
2477
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/kakurasu_unsolved.png" alt="Kakurasu unsolved" width="500">
2478
+
2479
+ Code to utilize this package and solve the puzzle:
2480
+
2481
+ ```python
2482
+ from puzzle_solver import kakurasu_solver as solver
2483
+ side = np.array([27, 6, 1, 12, 37, 37, 11, 4, 29, 23, 66, 55])
2484
+ bottom = np.array([22, 1, 25, 36, 10, 22, 25, 35, 32, 28, 45, 45])
2485
+ binst = solver.Board(side=side, bottom=bottom)
2486
+ solutions = binst.solve_and_print()
2487
+ ```
2488
+
2489
+
2490
+ **Script Output**
2491
+
2492
+ ```python
2493
+ Solution found
2494
+ [['X' 'X' ' ' 'X' ' ' ' ' ' ' 'X' ' ' ' ' ' ' 'X']
2495
+ [' ' ' ' ' ' ' ' ' ' 'X' ' ' ' ' ' ' ' ' ' ' ' ']
2496
+ ['X' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ']
2497
+ [' ' ' ' ' ' ' ' 'X' ' ' 'X' ' ' ' ' ' ' ' ' ' ']
2498
+ [' ' ' ' 'X' 'X' ' ' ' ' ' ' 'X' ' ' 'X' ' ' 'X']
2499
+ ['X' ' ' ' ' ' ' 'X' ' ' ' ' 'X' ' ' ' ' 'X' 'X']
2500
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'X' ' ']
2501
+ [' ' ' ' ' ' 'X' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ']
2502
+ [' ' ' ' 'X' ' ' ' ' 'X' ' ' ' ' 'X' ' ' 'X' ' ']
2503
+ [' ' ' ' ' ' 'X' ' ' ' ' 'X' ' ' ' ' ' ' ' ' 'X']
2504
+ [' ' ' ' 'X' ' ' ' ' 'X' 'X' 'X' 'X' 'X' 'X' 'X']
2505
+ ['X' ' ' ' ' 'X' ' ' ' ' ' ' 'X' 'X' 'X' 'X' 'X']]
2506
+ Solutions found: 1
2507
+ status: OPTIMAL
2508
+ Time taken: 0.00 seconds
2509
+ ```
2510
+
2511
+ **Solved puzzle**
2512
+
2513
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/kakurasu_solved.png" alt="Kakurasu solved" width="500">
2514
+
2515
+ ---
2516
+
2517
+ ## Star Battle (Puzzle Type #31)
2518
+
2519
+ * [**Play online**](https://www.puzzle-star-battle.com/)
2520
+
2521
+ * [**Solver Code**][31]
2522
+
2523
+ <details>
2524
+ <summary><strong>Rules</strong></summary>
2525
+
2526
+ You have to place stars on the grid according to the rules:
2527
+ - 2 stars cannot be adjacent horizontally, vertically or diagonally.
2528
+ - For 1★ puzzles, you have to place 1 star on each row, column and shape.
2529
+ - For 2★ puzzles, the stars per row, column and shape must be 2 etc.
2530
+
2531
+ </details>
2532
+
2533
+ **Unsolved puzzle**
2534
+
2535
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/star_battle_unsolved.png" alt="Star Battle unsolved" width="500">
2536
+
2537
+ Code to utilize this package and solve the puzzle:
2538
+
2539
+ 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.
2540
+
2541
+ ```python
2542
+ from puzzle_solver import star_battle_solver as solver
2543
+ board = np.array([
2544
+ ['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'],
2545
+ ['00', '01', '00', '01', '01', '01', '01', '01', '01', '01', '04', '04', '01', '02', '02', '02', '02', '05', '05', '05', '05', '05', '05', '03', '03'],
2546
+ ['00', '01', '01', '01', '01', '01', '01', '01', '01', '04', '04', '04', '04', '04', '02', '02', '05', '05', '05', '05', '05', '05', '03', '03', '03'],
2547
+ ['00', '01', '06', '04', '04', '04', '04', '04', '04', '04', '04', '04', '04', '04', '02', '05', '05', '05', '05', '05', '05', '05', '03', '07', '03'],
2548
+ ['00', '01', '06', '06', '06', '06', '06', '06', '06', '04', '04', '04', '04', '02', '02', '02', '02', '02', '05', '05', '05', '05', '05', '07', '03'],
2549
+ ['00', '00', '08', '06', '09', '09', '09', '09', '06', '04', '04', '04', '04', '02', '02', '02', '02', '02', '05', '05', '05', '05', '07', '07', '07'],
2550
+ ['00', '08', '08', '08', '08', '09', '09', '06', '06', '06', '04', '04', '04', '04', '02', '02', '02', '05', '05', '05', '07', '07', '07', '07', '07'],
2551
+ ['00', '00', '08', '08', '08', '09', '09', '09', '09', '06', '10', '10', '10', '10', '02', '02', '02', '05', '11', '11', '11', '11', '07', '07', '07'],
2552
+ ['08', '08', '08', '08', '09', '09', '09', '09', '09', '09', '10', '10', '10', '02', '02', '02', '02', '11', '11', '11', '11', '11', '11', '07', '11'],
2553
+ ['08', '08', '08', '08', '09', '09', '09', '09', '09', '10', '10', '10', '10', '02', '02', '02', '11', '11', '11', '11', '11', '11', '11', '07', '11'],
2554
+ ['08', '08', '08', '09', '09', '09', '09', '09', '10', '10', '10', '10', '10', '12', '12', '12', '12', '11', '11', '11', '11', '11', '11', '11', '11'],
2555
+ ['08', '08', '09', '09', '09', '09', '09', '08', '10', '10', '10', '10', '10', '10', '10', '10', '12', '11', '11', '11', '11', '13', '11', '13', '11'],
2556
+ ['14', '08', '08', '08', '08', '08', '08', '08', '10', '10', '10', '10', '10', '12', '12', '12', '12', '12', '11', '11', '11', '13', '11', '13', '15'],
2557
+ ['14', '14', '14', '14', '16', '08', '16', '16', '17', '10', '10', '10', '10', '10', '10', '10', '10', '12', '13', '13', '13', '13', '13', '13', '15'],
2558
+ ['14', '14', '14', '14', '16', '16', '16', '16', '17', '10', '10', '18', '18', '10', '19', '10', '12', '12', '13', '15', '15', '15', '15', '15', '15'],
2559
+ ['14', '14', '14', '14', '14', '16', '16', '17', '17', '18', '18', '18', '19', '19', '19', '10', '10', '10', '13', '15', '15', '15', '15', '15', '15'],
2560
+ ['14', '14', '14', '16', '16', '16', '16', '17', '18', '18', '20', '20', '19', '21', '19', '19', '19', '19', '13', '15', '15', '15', '15', '15', '15'],
2561
+ ['14', '16', '16', '16', '16', '16', '16', '17', '18', '18', '20', '21', '21', '21', '21', '19', '21', '19', '15', '15', '21', '15', '15', '15', '15'],
2562
+ ['14', '14', '14', '16', '16', '17', '17', '17', '18', '20', '20', '21', '20', '21', '21', '19', '21', '19', '15', '21', '21', '15', '15', '15', '15'],
2563
+ ['14', '14', '14', '16', '16', '16', '17', '17', '18', '18', '20', '20', '20', '20', '21', '21', '21', '21', '21', '21', '15', '15', '22', '22', '15'],
2564
+ ['14', '14', '14', '14', '23', '16', '17', '20', '18', '20', '20', '20', '20', '20', '20', '21', '24', '24', '24', '21', '15', '15', '22', '15', '15'],
2565
+ ['14', '14', '14', '14', '23', '20', '17', '20', '18', '20', '20', '20', '20', '24', '24', '24', '24', '24', '24', '21', '15', '22', '22', '22', '15'],
2566
+ ['14', '23', '23', '14', '23', '20', '20', '20', '18', '20', '20', '20', '20', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '22', '15'],
2567
+ ['14', '23', '14', '14', '23', '20', '23', '20', '18', '20', '20', '20', '20', '24', '24', '24', '24', '24', '24', '24', '22', '22', '22', '22', '22'],
2568
+ ['14', '23', '23', '23', '23', '23', '23', '20', '20', '20', '20', '20', '20', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24']
2569
+ ])
2570
+ binst = solver.Board(board=board, star_count=6)
2571
+ solutions = binst.solve_and_print()
2572
+ ```
2573
+
2574
+
2575
+ **Script Output**
2576
+
2577
+ ```python
2578
+ Solution found
2579
+ [' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' '],
2580
+ ['*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' '],
2581
+ [' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' '],
2582
+ ['*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*'],
2583
+ [' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' '],
2584
+ [' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*'],
2585
+ [' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' '],
2586
+ [' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*'],
2587
+ [' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' '],
2588
+ [' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' '],
2589
+ [' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' '],
2590
+ ['*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' '],
2591
+ [' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' '],
2592
+ ['*', ' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' '],
2593
+ [' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' '],
2594
+ [' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*'],
2595
+ [' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' '],
2596
+ [' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*'],
2597
+ [' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2598
+ ['*', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' '],
2599
+ [' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2600
+ ['*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' '],
2601
+ [' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2602
+ [' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*'],
2603
+ [' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', '*', ' ', '*', ' ', '*', ' ', '*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
2604
+ Solutions found: 1
2605
+ status: OPTIMAL
2606
+ Time taken: 0.38 seconds
2607
+ ```
2608
+
2609
+ **Solved puzzle**
2610
+
2611
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/star_battle_solved.png" alt="Star Battle solved" width="500">
2612
+
2613
+ ---
2614
+
2442
2615
  ---
2443
2616
 
2444
2617
  ## Why SAT / CP-SAT?
@@ -2519,3 +2692,5 @@ Issues and PRs welcome!
2519
2692
  [27]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/aquarium "puzzle_solver/src/puzzle_solver/puzzles/aquarium at master · Ar-Kareem/puzzle_solver · GitHub"
2520
2693
  [28]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/stitches "puzzle_solver/src/puzzle_solver/puzzles/stitches at master · Ar-Kareem/puzzle_solver · GitHub"
2521
2694
  [29]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/battleships "puzzle_solver/src/puzzle_solver/puzzles/battleships at master · Ar-Kareem/puzzle_solver · GitHub"
2695
+ [30]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/kakurasu "puzzle_solver/src/puzzle_solver/puzzles/kakurasu at master · Ar-Kareem/puzzle_solver · GitHub"
2696
+ [31]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/star_battle "puzzle_solver/src/puzzle_solver/puzzles/star_battle at master · Ar-Kareem/puzzle_solver · GitHub"
@@ -1,41 +1,43 @@
1
- puzzle_solver/__init__.py,sha256=1PIodDzUT4ZJ0dIhb2cspUjjsun4qeycBueNkEC6ugA,2118
1
+ puzzle_solver/__init__.py,sha256=u2RjFlPKYXFnsdHoh7Lo_0Gm99QAv_qv03fOF64Dsag,2269
2
2
  puzzle_solver/core/utils.py,sha256=3LlBDuie_G0uSlzibpQS2ULmEYSZmpJXh1kawj7rjkg,3396
3
3
  puzzle_solver/core/utils_ortools.py,sha256=qLTIzmITqmgGZvg8XpYAZ4c-lhD5sEDQfS8ECdQ_dkM,3005
4
4
  puzzle_solver/puzzles/aquarium/aquarium.py,sha256=BUfkAS2d9eG3TdMoe1cOGGeNYgKUebRvn-z9nsC9gvE,5708
5
- puzzle_solver/puzzles/battleships/battleships.py,sha256=0jwDR-bv6EHo8QTDZZ18WzShc7ohYtSSZw_DXh8y5lw,7483
6
- puzzle_solver/puzzles/bridges/bridges.py,sha256=zUT0TMIu8l982fqDMJfsTnTgqm48nG0iH8flsGT45_E,5489
7
- puzzle_solver/puzzles/chess_range/chess_melee.py,sha256=KnfD_Sxd8bso46eQYpIemp4MIqOUNoonyRVe6soK8kc,231
8
- puzzle_solver/puzzles/chess_range/chess_range.py,sha256=IaldwJR4d0VAUxME2QyvtJdUNzGzDV0FGs1iq9KqsRU,21072
5
+ puzzle_solver/puzzles/battleships/battleships.py,sha256=J1Y-zG2TOmJePCwQnUF8uE9cXL5v8GDVEGv30bQls6k,7467
6
+ puzzle_solver/puzzles/bridges/bridges.py,sha256=15A9uV4xjoqPRo_9CTnoKeGRxS3z2aMF619T1n0dTOQ,5402
7
+ puzzle_solver/puzzles/chess_range/chess_melee.py,sha256=D-_Oi8OyxsVe1j3dIKYwRlxgeb3NWLmDWGcv-oclY0c,195
8
+ puzzle_solver/puzzles/chess_range/chess_range.py,sha256=uMQGTIwzGskHIhI-tPYjT9a3wHUBIkZ18eXjV9IpUE4,21071
9
9
  puzzle_solver/puzzles/chess_range/chess_solo.py,sha256=U3v766UsZHx_dC3gxqU90VbjAXn-OlYhtrnnvJYFvrQ,401
10
10
  puzzle_solver/puzzles/chess_sequence/chess_sequence.py,sha256=6ap3Wouf2PxHV4P56B9ol1QT98Ym6VHaxorQZWl6LnY,13692
11
- puzzle_solver/puzzles/dominosa/dominosa.py,sha256=uh2vsba9HdSHGnYiYE8R_TZzQh5kge51Y1TMRyQlwek,7246
11
+ puzzle_solver/puzzles/dominosa/dominosa.py,sha256=Nmb7pn8U27QJwGy9F3wo8ylqo2_U51OAo3GN2soaNpc,7195
12
12
  puzzle_solver/puzzles/filling/filling.py,sha256=UAkNYjlfxOrYGrRVmuElhWPeW10xD6kiWuB8oELzy3w,9141
13
- puzzle_solver/puzzles/guess/guess.py,sha256=w8ZE-0MswR1_e7_MX622OiCJ8fGTloRHblYFvSA4yHc,10812
14
- puzzle_solver/puzzles/inertia/inertia.py,sha256=xHtQ09sI7hqPcs20foz6YVMuYCsw59TZQxTumAKJuBs,5658
15
- puzzle_solver/puzzles/inertia/tsp.py,sha256=qMyT_W5vBmmaFUB7Cl9rC5xJNdAdQvIJEx6yxlbG9hw,15240
13
+ puzzle_solver/puzzles/guess/guess.py,sha256=sH-NlYhxM3DNbhk4eGde09kgM0KaDvSbLrpHQiwcFGo,10791
14
+ puzzle_solver/puzzles/inertia/inertia.py,sha256=gJBahkh69CrSWNscalKEoP1j4X-Q3XpbIBMiG9PUpU0,5657
15
+ puzzle_solver/puzzles/inertia/tsp.py,sha256=6ZDxdg2f7GDsZeQpnSR2ay0-T4ZhTESJtkKMcm49OS0,15204
16
16
  puzzle_solver/puzzles/inertia/parse_map/parse_map.py,sha256=A9JQTNqamUdzlwqks0XQp3Hge3mzyTIVK6YtDJvqpL4,8422
17
+ puzzle_solver/puzzles/kakurasu/kakurasu.py,sha256=VNGMJnBHDi6WkghLObRLhUvkmrPaGphTTUDMC0TkQvQ,2064
17
18
  puzzle_solver/puzzles/keen/keen.py,sha256=tDb6C5S3Q0JAKPsdw-84WQ6PxRADELZHr_BK8FDH-NA,5039
18
19
  puzzle_solver/puzzles/light_up/light_up.py,sha256=iSA1rjZMFsnI0V0Nxivxox4qZkB7PvUrROSHXcoUXds,4541
19
20
  puzzle_solver/puzzles/magnets/magnets.py,sha256=-Wl49JD_PKeq735zQVMQ3XSQX6gdHiY-7PKw-Sh16jw,6474
20
21
  puzzle_solver/puzzles/map/map.py,sha256=sxc57tapB8Tsgam-yoDitln1o-EB_SbIYvO6WEYy3us,2582
21
- puzzle_solver/puzzles/minesweeper/minesweeper.py,sha256=TK2RSarbBpdhEmVjFydgvGPkLkjBM-a_JiOOmAA1OaU,5219
22
+ puzzle_solver/puzzles/minesweeper/minesweeper.py,sha256=LiQVOGkWCsc1WtX8CdPgL_WwAcaeUFuoi5_eqH8U2Og,5876
22
23
  puzzle_solver/puzzles/mosaic/mosaic.py,sha256=QX_nVpVKQg8OfaUcqFk9tKqsDyVqvZc6-XWvfI3YcSw,2175
23
24
  puzzle_solver/puzzles/nonograms/nonograms.py,sha256=1jmDTOCnmivmBlwtMDyyk3TVqH5IjapzLn7zLQ4qubk,6056
24
25
  puzzle_solver/puzzles/pearl/pearl.py,sha256=AP0whWwwZ-1zKingW14OwseYylNAr6NkXSrvdnPU6Rw,8566
25
26
  puzzle_solver/puzzles/range/range.py,sha256=g6ZuHuulYLpNFsqbnPoIB5KoGPllYppU10-Zzqfj5f8,6993
26
- puzzle_solver/puzzles/signpost/signpost.py,sha256=D19ua8rVwO6sgXq4nVLkZfEyz8hqc6qMOk3j-g44soU,3931
27
+ puzzle_solver/puzzles/signpost/signpost.py,sha256=-0_S6ycwzwlUf9-ZhP127Rgo5gMBOHiTM6t08dLLDac,3869
27
28
  puzzle_solver/puzzles/singles/singles.py,sha256=kwMENfqQ-OP3YIz5baY6LRcvYCsNfhImEXN00lwazKM,5658
28
- puzzle_solver/puzzles/stitches/stitches.py,sha256=YvT9WXvUMPLcFGOYXWIPyifCi6caZqRqBTuCgNmcTPQ,6662
29
- puzzle_solver/puzzles/stitches/parse_map/parse_map.py,sha256=pUB9tG__u4Fq_RCFG_4NNq3LRKAa6FRrvuuL64cUIRM,8866
29
+ puzzle_solver/puzzles/star_battle/star_battle.py,sha256=mNkxV68ejdjaGIZPC2LymfHk1i4T9XuAq1xUG7nnhMw,3192
30
+ puzzle_solver/puzzles/stitches/stitches.py,sha256=iK8t02q43gH3FPbuIDn4dK0sbaOgZOnw8yHNRNvNuIU,6534
31
+ puzzle_solver/puzzles/stitches/parse_map/parse_map.py,sha256=kbxTtJlfmE1IEA8Km3rALsfKXFl-0io1vd3d0Z-0OVo,8984
30
32
  puzzle_solver/puzzles/sudoku/sudoku.py,sha256=M_pry7XyKKzlfCF5rFi02lyOrj5GWZzXnDAxmD3NXvI,3588
31
33
  puzzle_solver/puzzles/tents/tents.py,sha256=iyVK2WXfIT5j_9qqlQg0WmwvixwXlZSsHGK3XA-KpII,6283
32
34
  puzzle_solver/puzzles/thermometers/thermometers.py,sha256=nsvJZkm7G8FALT27bpaB0lv5E_AWawqmvapQI8QcYXw,4015
33
35
  puzzle_solver/puzzles/towers/towers.py,sha256=QvL0Pp-Z2ewCeq9ZkNrh8MShKOh-Y52sFBSudve68wk,6496
34
- puzzle_solver/puzzles/tracks/tracks.py,sha256=VnAtxBkuUTHJYNXr1JGg0yYzJj3kRMBi8Nz7NHKS94A,9089
35
- puzzle_solver/puzzles/undead/undead.py,sha256=ygNugW5SOlYLy6d740gZ2IW9UJQ3SAr9vuMm0ZFr2nY,6630
36
+ puzzle_solver/puzzles/tracks/tracks.py,sha256=0K1YZMHiRIMmFwoD_JxB2c_xB6GYV8spgNUCL-JwDJM,9073
37
+ puzzle_solver/puzzles/undead/undead.py,sha256=IrCUfzQFBem658P5KKqldG7vd2TugTHehcwseCarerM,6604
36
38
  puzzle_solver/puzzles/unruly/unruly.py,sha256=sDF0oKT50G-NshyW2DYrvAgD9q9Ku9ANUyNhGSAu7cQ,3827
37
39
  puzzle_solver/utils/visualizer.py,sha256=2LmNoxEqb9PGWmBmHW6jh6OqFgNYguavhHB-9Dv5EUw,6113
38
- multi_puzzle_solver-0.9.5.dist-info/METADATA,sha256=SZoYsEEiQ3rFfY54sI23v4X1BO86lJwOC6Wv2HIEakk,121887
39
- multi_puzzle_solver-0.9.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
- multi_puzzle_solver-0.9.5.dist-info/top_level.txt,sha256=exwVUQa-anK9vYrpKzBPvH8bX43iElWI4VeNiAyBGJY,14
41
- multi_puzzle_solver-0.9.5.dist-info/RECORD,,
40
+ multi_puzzle_solver-0.9.7.dist-info/METADATA,sha256=7fMwUGqOwHaq_0hXWLuYPdPD0AYdwPDOVng23I2AwxI,133331
41
+ multi_puzzle_solver-0.9.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
42
+ multi_puzzle_solver-0.9.7.dist-info/top_level.txt,sha256=exwVUQa-anK9vYrpKzBPvH8bX43iElWI4VeNiAyBGJY,14
43
+ multi_puzzle_solver-0.9.7.dist-info/RECORD,,
puzzle_solver/__init__.py CHANGED
@@ -8,6 +8,7 @@ from puzzle_solver.puzzles.dominosa import dominosa as dominosa_solver
8
8
  from puzzle_solver.puzzles.filling import filling as filling_solver
9
9
  from puzzle_solver.puzzles.guess import guess as guess_solver
10
10
  from puzzle_solver.puzzles.inertia import inertia as inertia_solver
11
+ from puzzle_solver.puzzles.kakurasu import kakurasu as kakurasu_solver
11
12
  from puzzle_solver.puzzles.keen import keen as keen_solver
12
13
  from puzzle_solver.puzzles.light_up import light_up as light_up_solver
13
14
  from puzzle_solver.puzzles.magnets import magnets as magnets_solver
@@ -19,6 +20,7 @@ from puzzle_solver.puzzles.pearl import pearl as pearl_solver
19
20
  from puzzle_solver.puzzles.range import range as range_solver
20
21
  from puzzle_solver.puzzles.signpost import signpost as signpost_solver
21
22
  from puzzle_solver.puzzles.singles import singles as singles_solver
23
+ from puzzle_solver.puzzles.star_battle import star_battle as star_battle_solver
22
24
  from puzzle_solver.puzzles.stitches import stitches as stitches_solver
23
25
  from puzzle_solver.puzzles.sudoku import sudoku as sudoku_solver
24
26
  from puzzle_solver.puzzles.tents import tents as tents_solver
@@ -30,4 +32,4 @@ from puzzle_solver.puzzles.unruly import unruly as unruly_solver
30
32
 
31
33
  from puzzle_solver.puzzles.inertia.parse_map.parse_map import main as inertia_image_parser
32
34
 
33
- __version__ = '0.9.5'
35
+ __version__ = '0.9.7'
@@ -4,7 +4,7 @@ from typing import Optional
4
4
  import numpy as np
5
5
  from ortools.sat.python import cp_model
6
6
 
7
- from puzzle_solver.core.utils import Pos, get_all_pos, get_char, get_neighbors8, set_char, get_neighbors4, get_row_pos, get_col_pos, get_pos, in_bounds
7
+ from puzzle_solver.core.utils import Pos, get_all_pos, get_char, get_neighbors8, set_char, get_row_pos, get_col_pos, get_pos, in_bounds
8
8
  from puzzle_solver.core.utils_ortools import generic_solve_all, SingleSolution, or_constraint
9
9
 
10
10
  @dataclass
@@ -1,12 +1,10 @@
1
- import json
2
1
  from collections import defaultdict
3
- from dataclasses import dataclass
4
2
 
5
3
  import numpy as np
6
4
  from ortools.sat.python import cp_model
7
5
  from ortools.sat.python.cp_model import LinearExpr as lxp
8
6
 
9
- from puzzle_solver.core.utils import Pos, get_all_pos, get_char, set_char, get_neighbors8, get_next_pos, Direction, get_row_pos, get_col_pos
7
+ from puzzle_solver.core.utils import Pos, get_all_pos, get_char, set_char, get_row_pos, get_col_pos
10
8
  from puzzle_solver.core.utils_ortools import generic_solve_all, SingleSolution
11
9
 
12
10
 
@@ -1,5 +1,4 @@
1
1
  from .chess_range import Board as RangeBoard
2
- from .chess_range import PieceType
3
2
 
4
3
  class Board(RangeBoard):
5
4
  def __init__(self, pieces: list[str], colors: list[str]):
@@ -9,7 +9,6 @@ from puzzle_solver.core.utils import Pos, get_pos
9
9
  from puzzle_solver.core.utils_ortools import and_constraint, generic_solve_all, or_constraint
10
10
 
11
11
 
12
-
13
12
  class PieceType(Enum):
14
13
  KING = 1
15
14
  QUEEN = 2
@@ -3,8 +3,8 @@ from collections import defaultdict
3
3
  import numpy as np
4
4
  from ortools.sat.python import cp_model
5
5
 
6
- from puzzle_solver.core.utils import Pos, get_pos, get_all_pos, get_char, set_char, get_row_pos, get_col_pos, Direction, get_next_pos, in_bounds
7
- from puzzle_solver.core.utils_ortools import and_constraint, generic_solve_all, SingleSolution, or_constraint
6
+ from puzzle_solver.core.utils import Pos, get_all_pos, get_char, set_char, Direction, get_next_pos, in_bounds
7
+ from puzzle_solver.core.utils_ortools import generic_solve_all, SingleSolution, or_constraint
8
8
 
9
9
 
10
10
  def get_bool_var(model: cp_model.CpModel, var: cp_model.IntVar, eq_val: int, name: str) -> cp_model.IntVar:
@@ -1,8 +1,9 @@
1
- from collections import defaultdict
2
- import numpy as np
3
- from collections import Counter
1
+ from collections import Counter, defaultdict
4
2
  from itertools import product
5
3
 
4
+ import numpy as np
5
+
6
+
6
7
  class Board:
7
8
  def __init__(self, num_pegs: int = 4, all_colors: list[str] = ['R', 'Y', 'G', 'B', 'O', 'P'], show_warnings: bool = True, show_progress: bool = False):
8
9
  assert num_pegs >= 1, 'num_pegs must be at least 1'
@@ -3,7 +3,6 @@ from collections import defaultdict
3
3
  import numpy as np
4
4
 
5
5
  from puzzle_solver.core.utils import Direction8, Pos, get_all_pos, get_char, in_bounds, get_next_pos
6
-
7
6
  from . import tsp
8
7
 
9
8
 
@@ -1,8 +1,10 @@
1
- from collections import deque, defaultdict
1
+ from collections import defaultdict, deque
2
2
  from typing import Dict, List, Tuple, Set, Any, Optional
3
3
  import random
4
+
4
5
  from ortools.constraint_solver import pywrapcp, routing_enums_pb2
5
6
 
7
+
6
8
  Pos = Any # Hashable node id
7
9
 
8
10
  def solve_optimal_walk(
@@ -81,7 +83,6 @@ def solve_optimal_walk(
81
83
  prev = {n: None for n in nodes}
82
84
  if src not in adj:
83
85
  return dist, prev
84
- from collections import deque
85
86
  q = deque([src])
86
87
  dist[src] = 0
87
88
  while q:
@@ -0,0 +1,46 @@
1
+ import numpy as np
2
+ from ortools.sat.python import cp_model
3
+
4
+ from puzzle_solver.core.utils import Pos, get_all_pos, set_char, get_pos
5
+ from puzzle_solver.core.utils_ortools import generic_solve_all, SingleSolution
6
+
7
+
8
+ class Board:
9
+ def __init__(self, side: np.array, bottom: np.array):
10
+ assert side.ndim == 1, f'side must be 1d, got {side.ndim}'
11
+ self.V = side.shape[0]
12
+ assert bottom.ndim == 1, f'bottom must be 1d, got {bottom.ndim}'
13
+ self.H = bottom.shape[0]
14
+ self.side = side
15
+ self.bottom = bottom
16
+
17
+ self.model = cp_model.CpModel()
18
+ self.model_vars: dict[Pos, cp_model.IntVar] = {}
19
+
20
+ self.create_vars()
21
+ self.add_all_constraints()
22
+
23
+ def create_vars(self):
24
+ for pos in get_all_pos(self.V, self.H):
25
+ self.model_vars[pos] = self.model.NewBoolVar(f'{pos}')
26
+
27
+ def add_all_constraints(self):
28
+ for row in range(self.V):
29
+ self.model.Add(sum([self.model_vars[get_pos(x=col, y=row)] * (col + 1) for col in range(self.H)]) == self.side[row])
30
+ for col in range(self.H):
31
+ self.model.Add(sum([self.model_vars[get_pos(x=col, y=row)] * (row + 1) for row in range(self.V)]) == self.bottom[col])
32
+
33
+ def solve_and_print(self, verbose: bool = True):
34
+ def board_to_solution(board: Board, solver: cp_model.CpSolverSolutionCallback) -> SingleSolution:
35
+ assignment: dict[Pos, int] = {}
36
+ for pos, var in board.model_vars.items():
37
+ assignment[pos] = solver.value(var)
38
+ return SingleSolution(assignment=assignment)
39
+ def callback(single_res: SingleSolution):
40
+ print("Solution found")
41
+ res = np.full((self.V, self.H), ' ', dtype=object)
42
+ for pos in get_all_pos(self.V, self.H):
43
+ c = 'X' if single_res.assignment[pos] else ' '
44
+ set_char(res, pos, c)
45
+ print(res)
46
+ return generic_solve_all(self, board_to_solution, callback=callback if verbose else None, verbose=verbose)
@@ -1,5 +1,5 @@
1
1
  import time
2
- from typing import Union
2
+ from typing import Union, Optional
3
3
 
4
4
  import numpy as np
5
5
  from ortools.sat.python import cp_model
@@ -10,7 +10,7 @@ from puzzle_solver.core.utils_ortools import generic_solve_all, SingleSolution
10
10
 
11
11
 
12
12
  class Board:
13
- def __init__(self, board: np.array, mine_count: int):
13
+ def __init__(self, board: np.array, mine_count: Optional[int] = None):
14
14
  assert board.ndim == 2, f'board must be 2d, got {board.ndim}'
15
15
  assert all(isinstance(i.item(), str) and (str(i.item()) in [' ', 'F', 'S', 'M', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']) for i in np.nditer(board)), 'board must be either F, S, M, 0-9 or space'
16
16
  self.board = board
@@ -28,7 +28,8 @@ class Board:
28
28
  self.model_vars[pos] = self.model.NewBoolVar(f'{pos}')
29
29
 
30
30
  def add_all_constraints(self):
31
- self.model.Add(lxp.Sum(list(self.model_vars.values())) == self.mine_count)
31
+ if self.mine_count is not None:
32
+ self.model.Add(lxp.Sum(list(self.model_vars.values())) == self.mine_count)
32
33
  for pos in get_all_pos(self.V, self.H):
33
34
  c = get_char(self.board, pos)
34
35
  if c in ['F', ' ']:
@@ -55,7 +56,7 @@ def _is_feasible(board: np.array, pos: Pos = None, value: str = None, mine_count
55
56
  return SingleSolution(assignment={pos: solver.value(var) for pos, var in board.model_vars.items()})
56
57
  return len(generic_solve_all(board, board_to_solution, max_solutions=1, verbose=False)) >= 1
57
58
 
58
- def _is_safe(board: np.array, pos: Pos, mine_count: int) -> Union[bool, None]:
59
+ def _is_safe(board: np.array, pos: Pos, mine_count: Optional[int] = None) -> Union[bool, None]:
59
60
  """Returns a True if the position is safe, False if it is a mine, otherwise None"""
60
61
  safe_feasible = _is_feasible(board, pos, 'S', mine_count=mine_count)
61
62
  mine_feasible = _is_feasible(board, pos, 'M', mine_count=mine_count)
@@ -67,7 +68,7 @@ def _is_safe(board: np.array, pos: Pos, mine_count: int) -> Union[bool, None]:
67
68
  return False
68
69
  raise ValueError(f"Position {pos} has both safe and mine infeasible")
69
70
 
70
- def give_next_guess(board: np.array, mine_count: int, verbose: bool = True):
71
+ def give_next_guess(board: np.array, mine_count: Optional[int] = None, verbose: bool = True):
71
72
  tic = time.time()
72
73
  is_feasible = _is_feasible(board, mine_count=mine_count)
73
74
  if not is_feasible:
@@ -108,4 +109,16 @@ def give_next_guess(board: np.array, mine_count: int, verbose: bool = True):
108
109
  print('-'*10)
109
110
  toc = time.time()
110
111
  print(f"Time taken: {toc - tic:.2f} seconds")
111
- return safe_positions, new_garuneed_mine_positions, wrong_flag_positions
112
+ return safe_positions, new_garuneed_mine_positions, wrong_flag_positions
113
+
114
+ def print_board(board: np.array, safe_positions: set[Pos], new_garuneed_mine_positions: set[Pos], wrong_flag_positions: set[Pos]):
115
+ res = np.full((board.shape[0], board.shape[1]), ' ', dtype=object)
116
+ for pos in get_all_pos(board.shape[0], board.shape[1]):
117
+ if pos in safe_positions:
118
+ set_char(res, pos, 'S')
119
+ elif pos in new_garuneed_mine_positions:
120
+ set_char(res, pos, 'M')
121
+ elif get_char(board, pos) == 'F' and pos not in wrong_flag_positions:
122
+ set_char(res, pos, 'F')
123
+
124
+ print(res)
@@ -1,10 +1,8 @@
1
- from enum import Enum
2
-
3
1
  import numpy as np
4
2
  from ortools.sat.python import cp_model
5
3
  from ortools.sat.python.cp_model import LinearExpr as lxp
6
4
 
7
- from puzzle_solver.core.utils import Pos, get_all_pos, get_char, set_char, in_bounds, get_next_pos, Direction, get_row_pos, get_col_pos, Direction8
5
+ from puzzle_solver.core.utils import Pos, get_all_pos, get_char, set_char, in_bounds, get_next_pos, Direction8
8
6
  from puzzle_solver.core.utils_ortools import generic_solve_all, SingleSolution
9
7
 
10
8
 
@@ -0,0 +1,63 @@
1
+ import numpy as np
2
+ from ortools.sat.python import cp_model
3
+
4
+ from puzzle_solver.core.utils import Pos, get_all_pos, get_char, set_char, get_neighbors8, get_row_pos, get_col_pos
5
+ from puzzle_solver.core.utils_ortools import generic_solve_all, SingleSolution
6
+
7
+
8
+ class Board:
9
+ def __init__(self, board: np.array, star_count: int = 1):
10
+ assert board.ndim == 2, f'board must be 2d, got {board.ndim}'
11
+ assert board.shape[0] == board.shape[1], 'board must be square'
12
+ assert star_count >= 1 and isinstance(star_count, int), 'star_count must be an integer greater than or equal to 1'
13
+ assert all((str(c.item()).isdecimal() for c in np.nditer(board))), 'board must contain only digits'
14
+ self.board = board
15
+ self.V = board.shape[0]
16
+ self.H = board.shape[1]
17
+ self.N = self.V * self.H
18
+ self.star_count = star_count
19
+ self.block_numbers = set([int(c.item()) for c in np.nditer(board)])
20
+ self.blocks = {i: [pos for pos in get_all_pos(self.V, self.H) if int(get_char(self.board, pos)) == i] for i in self.block_numbers}
21
+
22
+ self.model = cp_model.CpModel()
23
+ self.model_vars: dict[Pos, cp_model.IntVar] = {}
24
+
25
+ self.create_vars()
26
+ self.add_all_constraints()
27
+
28
+ def create_vars(self):
29
+ for pos in get_all_pos(self.V, self.H):
30
+ self.model_vars[pos] = self.model.NewBoolVar(f'{pos}')
31
+
32
+ def add_all_constraints(self):
33
+ # N stars per row / column / block
34
+ for row in range(self.V):
35
+ self.model.Add(sum(self.model_vars[pos] for pos in get_row_pos(row, H=self.H)) == self.star_count)
36
+ for col in range(self.H):
37
+ self.model.Add(sum(self.model_vars[pos] for pos in get_col_pos(col, V=self.V)) == self.star_count)
38
+ for block_i in self.block_numbers:
39
+ self.model.Add(sum(self.model_vars[pos] for pos in self.blocks[block_i]) == self.star_count)
40
+ # stars cant be adjacent
41
+ for pos in get_all_pos(self.V, self.H):
42
+ for neighbor in get_neighbors8(pos, V=self.V, H=self.H):
43
+ self.model.Add(self.model_vars[neighbor] == 0).OnlyEnforceIf(self.model_vars[pos])
44
+
45
+
46
+ def solve_and_print(self, verbose: bool = True):
47
+ def board_to_solution(board: Board, solver: cp_model.CpSolverSolutionCallback) -> SingleSolution:
48
+ assignment: dict[Pos, int] = {}
49
+ for pos, var in board.model_vars.items():
50
+ assignment[pos] = solver.value(var)
51
+ return SingleSolution(assignment=assignment)
52
+ def callback(single_res: SingleSolution):
53
+ print("Solution found")
54
+ res = np.full((self.V, self.H), ' ', dtype=object)
55
+ for pos in get_all_pos(self.V, self.H):
56
+ c = '*' if single_res.assignment[pos] == 1 else ' '
57
+ set_char(res, pos, c)
58
+ for row in range(self.V):
59
+ print(res[row].tolist(), end='')
60
+ if row != self.V - 1:
61
+ print(',', end='')
62
+ print()
63
+ return generic_solve_all(self, board_to_solution, callback=callback if verbose else None, verbose=verbose)
@@ -207,4 +207,5 @@ if __name__ == '__main__':
207
207
  # to run this script and visualize the output, in the root run:
208
208
  # python .\src\puzzle_solver\puzzles\stitches\parse_map\parse_map.py | python .\src\puzzle_solver\utils\visualizer.py --read_stdin
209
209
  # main(Path(__file__).parent / 'input_output' / 'MTM6OSw4MjEsNDAx.png')
210
- main(Path(__file__).parent / 'input_output' / 'weekly_oct_3rd_2025.png')
210
+ # main(Path(__file__).parent / 'input_output' / 'weekly_oct_3rd_2025.png')
211
+ main(Path(__file__).parent / 'input_output' / 'star_battle_67f73ff90cd8cdb4b3e30f56f5261f4968f5dac940bc6.png')
@@ -1,11 +1,9 @@
1
- from collections import defaultdict
2
1
  from typing import Union
3
2
 
4
3
  import numpy as np
5
4
  from ortools.sat.python import cp_model
6
- from ortools.sat.python.cp_model import LinearExpr as lxp
7
5
 
8
- from puzzle_solver.core.utils import Pos, get_all_pos, get_char, get_neighbors4, set_char, get_neighbors8, get_next_pos, Direction, get_row_pos, get_col_pos, in_bounds, get_opposite_direction
6
+ from puzzle_solver.core.utils import Pos, get_all_pos, get_char, set_char, get_next_pos, Direction, get_row_pos, get_col_pos, in_bounds, get_opposite_direction
9
7
  from puzzle_solver.core.utils_ortools import generic_solve_all, SingleSolution, and_constraint
10
8
 
11
9
 
@@ -2,7 +2,7 @@ from collections import defaultdict
2
2
  import numpy as np
3
3
  from ortools.sat.python import cp_model
4
4
 
5
- from puzzle_solver.core.utils import Pos, get_all_pos, set_char, get_char, get_neighbors4, Direction, in_bounds, get_next_pos, get_row_pos, get_col_pos, get_opposite_direction
5
+ from puzzle_solver.core.utils import Pos, get_all_pos, set_char, get_char, Direction, in_bounds, get_next_pos, get_row_pos, get_col_pos, get_opposite_direction
6
6
  from puzzle_solver.core.utils_ortools import generic_solve_all, SingleSolution, and_constraint, or_constraint
7
7
 
8
8
 
@@ -6,7 +6,7 @@ import numpy as np
6
6
  from ortools.sat.python import cp_model
7
7
  from ortools.sat.python.cp_model import LinearExpr as lxp
8
8
 
9
- from puzzle_solver.core.utils import Pos, get_all_pos, set_char, get_pos, get_next_pos, in_bounds, get_char, Direction, get_row_pos, get_col_pos
9
+ from puzzle_solver.core.utils import Pos, get_all_pos, set_char, get_pos, get_next_pos, in_bounds, get_char, Direction
10
10
  from puzzle_solver.core.utils_ortools import generic_solve_all, SingleSolution
11
11
 
12
12