multi-puzzle-solver 0.9.3__tar.gz → 0.9.5__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.
Files changed (75) hide show
  1. {multi_puzzle_solver-0.9.3/src/multi_puzzle_solver.egg-info → multi_puzzle_solver-0.9.5}/PKG-INFO +181 -5
  2. multi_puzzle_solver-0.9.3/PKG-INFO → multi_puzzle_solver-0.9.5/README.md +2495 -2345
  3. multi_puzzle_solver-0.9.3/README.md → multi_puzzle_solver-0.9.5/src/multi_puzzle_solver.egg-info/PKG-INFO +2521 -2319
  4. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/multi_puzzle_solver.egg-info/SOURCES.txt +5 -0
  5. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/__init__.py +3 -1
  6. multi_puzzle_solver-0.9.5/src/puzzle_solver/puzzles/battleships/battleships.py +153 -0
  7. multi_puzzle_solver-0.9.5/src/puzzle_solver/puzzles/stitches/parse_map/parse_map.py +210 -0
  8. multi_puzzle_solver-0.9.5/src/puzzle_solver/puzzles/stitches/stitches.py +111 -0
  9. multi_puzzle_solver-0.9.5/src/puzzle_solver/utils/visualizer.py +141 -0
  10. multi_puzzle_solver-0.9.5/tests/test_battleships.py +65 -0
  11. multi_puzzle_solver-0.9.5/tests/test_stitches.py +131 -0
  12. multi_puzzle_solver-0.9.3/src/puzzle_solver/utils/visualizer.py +0 -108
  13. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/pyproject.toml +0 -0
  14. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/setup.cfg +0 -0
  15. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/multi_puzzle_solver.egg-info/dependency_links.txt +0 -0
  16. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/multi_puzzle_solver.egg-info/requires.txt +0 -0
  17. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/multi_puzzle_solver.egg-info/top_level.txt +0 -0
  18. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/core/utils.py +0 -0
  19. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/core/utils_ortools.py +0 -0
  20. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/aquarium/aquarium.py +0 -0
  21. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/bridges/bridges.py +0 -0
  22. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/chess_range/chess_melee.py +0 -0
  23. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/chess_range/chess_range.py +0 -0
  24. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/chess_range/chess_solo.py +0 -0
  25. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/dominosa/dominosa.py +0 -0
  26. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/filling/filling.py +0 -0
  27. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/guess/guess.py +0 -0
  28. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/inertia/inertia.py +0 -0
  29. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/inertia/parse_map/parse_map.py +0 -0
  30. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/inertia/tsp.py +0 -0
  31. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/keen/keen.py +0 -0
  32. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/light_up/light_up.py +0 -0
  33. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/magnets/magnets.py +0 -0
  34. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/map/map.py +0 -0
  35. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/minesweeper/minesweeper.py +0 -0
  36. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/mosaic/mosaic.py +0 -0
  37. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/nonograms/nonograms.py +0 -0
  38. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/pearl/pearl.py +0 -0
  39. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/range/range.py +0 -0
  40. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/signpost/signpost.py +0 -0
  41. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/singles/singles.py +0 -0
  42. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/sudoku/sudoku.py +0 -0
  43. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/tents/tents.py +0 -0
  44. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/thermometers/thermometers.py +0 -0
  45. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/towers/towers.py +0 -0
  46. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/tracks/tracks.py +0 -0
  47. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/undead/undead.py +0 -0
  48. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/src/puzzle_solver/puzzles/unruly/unruly.py +0 -0
  49. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_aquarium.py +0 -0
  50. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_bridges.py +0 -0
  51. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_chess_melee.py +0 -0
  52. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_chess_range.py +0 -0
  53. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_chess_solo.py +0 -0
  54. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_dominosa.py +0 -0
  55. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_filling.py +0 -0
  56. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_guess.py +0 -0
  57. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_inertia.py +0 -0
  58. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_keen.py +0 -0
  59. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_light_up.py +0 -0
  60. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_magnets.py +0 -0
  61. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_map.py +0 -0
  62. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_minesweeper.py +0 -0
  63. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_mosaic.py +0 -0
  64. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_nonograms.py +0 -0
  65. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_pearl.py +0 -0
  66. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_range.py +0 -0
  67. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_signpost.py +0 -0
  68. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_singles.py +0 -0
  69. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_sudoku.py +0 -0
  70. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_tents.py +0 -0
  71. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_thermometers.py +0 -0
  72. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_towers.py +0 -0
  73. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_tracks.py +0 -0
  74. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_undead.py +0 -0
  75. {multi_puzzle_solver-0.9.3 → multi_puzzle_solver-0.9.5}/tests/test_unruly.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multi-puzzle-solver
3
- Version: 0.9.3
3
+ Version: 0.9.5
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
@@ -232,6 +232,16 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
232
232
  <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/aquarium_solved.png" alt="Aquarium" width="140">
233
233
  </a>
234
234
  </td>
235
+ <td align="center">
236
+ <a href="#stitches-puzzle-type-28"><b>Stitches</b><br><br>
237
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/stitches_solved.png" alt="Stitches" width="140">
238
+ </a>
239
+ </td>
240
+ <td align="center">
241
+ <a href="#battleships-puzzle-type-29"><b>Battleships</b><br><br>
242
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/battleships_solved.png" alt="Battleships" width="140">
243
+ </a>
244
+ </td>
235
245
  </tr>
236
246
  </table>
237
247
 
@@ -274,6 +284,8 @@ These are all the puzzles that are implemented in this repo. <br> Click on any o
274
284
  - [Chess Melee (Puzzle Type #25)](#chess-melee-puzzle-type-25)
275
285
  - [Thermometers (Puzzle Type #26)](#thermometers-puzzle-type-26)
276
286
  - [Aquarium (Puzzle Type #27)](#aquarium-puzzle-type-27)
287
+ - [Stitches (Puzzle Type #28)](#stitches-puzzle-type-28)
288
+ - [Battleships (Puzzle Type #29)](#battleships-puzzle-type-29)
277
289
  - [Why SAT / CP-SAT?](#why-sat--cp-sat)
278
290
  - [Testing](#testing)
279
291
  - [Contributing](#contributing)
@@ -2134,8 +2146,6 @@ The numbers outside the grid show the number of filled cells horizontally and ve
2134
2146
 
2135
2147
  Code to utilize this package and solve the puzzle:
2136
2148
 
2137
- (Note that this puzzle does not typically have a unique solution. Thus, we specify here that we only want the first valid solution that the solver finds.)
2138
-
2139
2149
  ```python
2140
2150
  from puzzle_solver import thermometers_solver as solver
2141
2151
  board = np.array([
@@ -2184,6 +2194,12 @@ status: OPTIMAL
2184
2194
  Time taken: 0.01 seconds
2185
2195
  ```
2186
2196
 
2197
+ **Solved puzzle**
2198
+
2199
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/thermometers_solved.png" alt="Thermometers solved" width="500">
2200
+
2201
+ ---
2202
+
2187
2203
  ## Aquarium (Puzzle Type #27)
2188
2204
 
2189
2205
  * [**Play online**](https://www.puzzle-aquarium.com/)
@@ -2209,8 +2225,6 @@ The numbers outside the grid show the number of filled cells horizontally and ve
2209
2225
 
2210
2226
  Code to utilize this package and solve the puzzle:
2211
2227
 
2212
- (Note that this puzzle does not typically have a unique solution. Thus, we specify here that we only want the first valid solution that the solver finds.)
2213
-
2214
2228
  ```python
2215
2229
  from puzzle_solver import aquarium_solver as solver
2216
2230
  board = np.array([
@@ -2265,6 +2279,166 @@ Time taken: 0.02 seconds
2265
2279
 
2266
2280
  ---
2267
2281
 
2282
+ ## Stitches (Puzzle Type #28)
2283
+
2284
+ * [**Play online**](https://www.puzzle-stitches.com/)
2285
+
2286
+ * [**Solver Code**][28]
2287
+
2288
+ <details>
2289
+ <summary><strong>Rules</strong></summary>
2290
+
2291
+ - Connect each block with ALL its neighbor blocks with exactly 1 "stitch" each.
2292
+ - A "stitch" connects 2 orthogonally adjacent cells from different blocks.
2293
+ - 2 stitches cannot share a hole.
2294
+ - The clues outside the grid indicate the number of holes on that row/column
2295
+ - For 2÷ puzzles, you have to use 2 stitches to connect neighbor blocks, for 3÷ puzzles - 3 stitches etc.
2296
+
2297
+ </details>
2298
+
2299
+ **Unsolved puzzle**
2300
+
2301
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/stitches_unsolved.png" alt="Stitches unsolved" width="500">
2302
+
2303
+ Code to utilize this package and solve the puzzle:
2304
+
2305
+ ```python
2306
+ from puzzle_solver import stitches_solver as solver
2307
+ board = np.array([
2308
+ ["00", "00", "00", "00", "00", "01", "01", "01", "01", "01", "01", "01", "01", "02", "02"],
2309
+ ["00", "03", "03", "04", "00", "00", "01", "05", "05", "05", "05", "05", "01", "01", "02"],
2310
+ ["00", "03", "04", "04", "04", "00", "05", "05", "05", "05", "05", "05", "05", "05", "02"],
2311
+ ["00", "03", "04", "04", "04", "04", "05", "05", "06", "05", "02", "02", "02", "02", "02"],
2312
+ ["07", "03", "03", "03", "03", "04", "06", "06", "06", "06", "06", "06", "06", "02", "02"],
2313
+ ["07", "07", "07", "03", "03", "04", "04", "06", "08", "08", "08", "06", "02", "02", "02"],
2314
+ ["07", "07", "03", "03", "03", "04", "04", "08", "08", "08", "08", "06", "06", "06", "02"],
2315
+ ["07", "07", "07", "07", "07", "08", "08", "08", "09", "09", "08", "06", "08", "06", "02"],
2316
+ ["10", "10", "07", "07", "09", "09", "09", "09", "09", "09", "08", "08", "08", "11", "02"],
2317
+ ["10", "10", "07", "09", "09", "09", "09", "09", "09", "09", "09", "08", "08", "11", "02"],
2318
+ ["10", "09", "09", "09", "12", "12", "12", "13", "09", "09", "11", "11", "11", "11", "11"],
2319
+ ["10", "10", "10", "09", "12", "12", "12", "13", "09", "11", "11", "11", "13", "13", "11"],
2320
+ ["14", "15", "10", "12", "12", "16", "17", "13", "13", "11", "13", "13", "13", "13", "11"],
2321
+ ["14", "15", "10", "12", "16", "16", "17", "17", "13", "13", "13", "13", "13", "13", "11"],
2322
+ ["14", "15", "15", "12", "16", "16", "17", "17", "17", "17", "17", "13", "13", "13", "13"]
2323
+ ])
2324
+ top = np.array([6, 6, 9, 5, 3, 8, 9, 3, 1, 4, 4, 1, 4, 8, 5])
2325
+ side = np.array([0, 10, 6, 4, 4, 1, 5, 8, 2, 6, 5, 11, 4, 3, 7])
2326
+ binst = solver.Board(board=board, top=top, side=side)
2327
+ solutions = binst.solve_and_print()
2328
+ ```
2329
+
2330
+ Note: `solver.Board` accepts an optional `connection_count=N` parameter to specify the (÷N) stitches puzzle (by default, 1 stitch).
2331
+
2332
+ **Script Output**
2333
+
2334
+ ```python
2335
+ Solution found
2336
+ [[' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ']
2337
+ ['R' 'L' 'D' 'R' 'L' 'R' 'L' ' ' ' ' ' ' ' ' ' ' 'D' 'R' 'L']
2338
+ [' ' ' ' 'U' ' ' ' ' 'R' 'L' ' ' ' ' ' ' ' ' ' ' 'U' 'R' 'L']
2339
+ ['D' ' ' ' ' ' ' ' ' 'R' 'L' ' ' ' ' 'D' ' ' ' ' ' ' ' ' ' ']
2340
+ ['U' ' ' ' ' ' ' ' ' 'R' 'L' ' ' ' ' 'U' ' ' ' ' ' ' ' ' ' ']
2341
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'D' ' ']
2342
+ [' ' ' ' 'D' ' ' ' ' ' ' 'R' 'L' ' ' 'D' ' ' ' ' ' ' 'U' ' ']
2343
+ [' ' 'D' 'U' ' ' 'R' 'L' ' ' ' ' ' ' 'U' ' ' 'R' 'L' 'D' ' ']
2344
+ [' ' 'U' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'U' ' ']
2345
+ [' ' ' ' 'R' 'L' ' ' ' ' ' ' ' ' ' ' ' ' 'D' ' ' 'R' 'L' 'D']
2346
+ [' ' ' ' 'D' ' ' ' ' ' ' 'R' 'L' ' ' ' ' 'U' ' ' ' ' ' ' 'U']
2347
+ ['D' 'D' 'U' 'R' 'L' 'D' 'D' 'R' 'L' ' ' ' ' ' ' ' ' 'R' 'L']
2348
+ ['U' 'U' ' ' ' ' ' ' 'U' 'U' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ']
2349
+ [' ' ' ' 'R' 'L' ' ' ' ' ' ' ' ' ' ' ' ' 'D' ' ' ' ' ' ' ' ']
2350
+ ['R' 'L' 'R' 'L' ' ' 'R' 'L' ' ' ' ' ' ' 'U' ' ' ' ' ' ' ' ']]
2351
+ Solutions found: 1
2352
+ status: OPTIMAL
2353
+ Time taken: 0.01 seconds
2354
+ ```
2355
+
2356
+ **Solved puzzle**
2357
+
2358
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/stitches_solved.png" alt="Stitches solved" width="500">
2359
+
2360
+ ---
2361
+
2362
+ ## Battleships (Puzzle Type #29)
2363
+
2364
+ * [**Play online**](https://www.puzzle-battleships.com/)
2365
+
2366
+ * [**Solver Code**][29]
2367
+
2368
+ <details>
2369
+ <summary><strong>Rules</strong></summary>
2370
+
2371
+ - You have to find the location of the battleships hidden in the grid. Some battleships may be partially revealed.
2372
+ - A battleship is a straight line of consecutive black cells.
2373
+ - The number of the battleships from each size is shown in the legend.
2374
+ - 2 battleships cannot touch each other (even diagonally)
2375
+ - The numbers outside the grid show the number of cells occupied by battleships on that row/column.
2376
+
2377
+ </details>
2378
+
2379
+ **Unsolved puzzle**
2380
+
2381
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/battleships_unsolved.png" alt="Battleships unsolved" width="500">
2382
+
2383
+ Code to utilize this package and solve the puzzle:
2384
+
2385
+ ```python
2386
+ from puzzle_solver import battleships_solver as solver
2387
+ board = np.array([
2388
+ [' ', ' ', ' ', ' ', ' ', 'S', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2389
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'S', ' ', ' ', ' ', ' '],
2390
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'O', ' ', ' '],
2391
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2392
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2393
+ ['W', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2394
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2395
+ [' ', ' ', ' ', ' ', ' ', ' ', 'O', ' ', ' ', ' ', ' ', 'W', ' ', ' ', 'R'],
2396
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2397
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2398
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2399
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'U', ' ', ' ', ' ', ' '],
2400
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', 'L', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2401
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
2402
+ [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'S'],
2403
+ ])
2404
+ top = np.array([2, 2, 4, 2, 1, 2, 1, 2, 4, 1, 3, 2, 5, 2, 2])
2405
+ side = np.array([1, 2, 1, 1, 0, 7, 0, 9, 2, 2, 5, 1, 3, 0, 1])
2406
+ ship_counts = {1: 5, 2: 4, 3: 3, 4: 2, 5: 1}
2407
+ binst = solver.Board(board=board, top=top, side=side, ship_counts=ship_counts)
2408
+ solutions = binst.solve_and_print()
2409
+ ```
2410
+
2411
+
2412
+ **Script Output**
2413
+
2414
+ ```python
2415
+ Solution found
2416
+ [[' ' ' ' ' ' ' ' ' ' 'S' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ']
2417
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'S' ' ' 'S' ' ' ' ']
2418
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'S' ' ' ' ']
2419
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'S' ' ' ' ']
2420
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ']
2421
+ [' ' 'S' 'S' 'S' 'S' ' ' ' ' ' ' ' ' ' ' ' ' 'S' 'S' 'S' ' ']
2422
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ']
2423
+ [' ' ' ' 'S' ' ' ' ' 'S' 'S' 'S' 'S' 'S' ' ' ' ' 'S' 'S' 'S']
2424
+ ['S' ' ' 'S' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ']
2425
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'S' ' ' ' ' 'S' ' ' ' ' ' ']
2426
+ ['S' 'S' 'S' 'S' ' ' ' ' ' ' ' ' 'S' ' ' ' ' ' ' ' ' ' ' ' ']
2427
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'S' ' ' ' ' ' ' ' ']
2428
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' 'S' 'S' ' ' 'S' ' ' ' ' ' ' ' ']
2429
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ']
2430
+ [' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'S']]
2431
+ Solutions found: 1
2432
+ status: OPTIMAL
2433
+ Time taken: 0.12 seconds
2434
+ ```
2435
+
2436
+ **Solved puzzle**
2437
+
2438
+ <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/battleships_solved.png" alt="Battleships solved" width="500">
2439
+
2440
+ ---
2441
+
2268
2442
  ---
2269
2443
 
2270
2444
  ## Why SAT / CP-SAT?
@@ -2343,3 +2517,5 @@ Issues and PRs welcome!
2343
2517
  [25]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range#chess-melee-puzzle-type-25 "puzzle_solver/src/puzzle_solver/puzzles/chess_range at master · Ar-Kareem/puzzle_solver · GitHub"
2344
2518
  [26]: https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/thermometers "puzzle_solver/src/puzzle_solver/puzzles/thermometers at master · Ar-Kareem/puzzle_solver · GitHub"
2345
2519
  [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
+ [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
+ [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"