multi-puzzle-solver 1.1.10
Efficient solvers for countless (90+) types of puzzles (like Sudoku, Minesweeper, etc.) with a simple python API.
Requires Python: >=3.9
Keywords: puzzle, solver, sat, cp-sat, google-or-tools, efficient, logic, puzzle-solver, puzzle-solver-python, sudoku, nonograms, minesweeper, dominosa, lightup, map, inertia, tents, towers, tracks, undead, unruly, bridges, pearl, range, signpost, singles, magnets

# Python Puzzle Solver

Solve countless (90+) classical logic puzzles automatically in Python. 

Can also tell you if a partial puzzle has a single unique solution or not (and retrieves all possible solutions).

## Install

```bash
pip install multi-puzzle-solver
```

<div align="center">


## 🕹️ Puzzle Gallery

These are all the puzzles that are implemented in this repo. <br> Click on any of them to go to that Puzzle's README.

<table>
<!-- AUTO-GENERATED GALLERY START -->

<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/nonograms"><b>Nonograms</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/nonogram_solved.png" alt="Nonograms" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/sudoku"><b>Sudoku</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/sudoku_solved.png" alt="Sudoku" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/minesweeper"><b>Minesweeper</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/minesweeper_pre.png" alt="Minesweeper" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/dominosa"><b>Dominosa</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/dominosa_solved.png" alt="Dominosa" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/light_up"><b>Light Up</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/lightup_solved.png" alt="Light Up" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/tents"><b>Tents</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/tents_solved.png" alt="Tents" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/filling"><b>Filling</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/filling_solved.png" alt="Filling" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/keen"><b>Keen</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/keen_solved.png" alt="Keen" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/towers"><b>Towers</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/towers_solved.png" alt="Towers" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/singles"><b>Singles</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/singles_solved.png" alt="Singles" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/magnets"><b>Magnets</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/magnets_solved.png" alt="Magnets" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/signpost"><b>Signpost</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/signpost_solved.png" alt="Signpost" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/range"><b>Range</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/range_solved.png" alt="Range" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/undead"><b>Undead</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/undead_solved.png" alt="Undead" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/unruly"><b>Unruly</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/unruly_solved.png" alt="Unruly" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/tracks"><b>Tracks</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/tracks_solved.png" alt="Tracks" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/mosaic"><b>Mosaic</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/mosaic_solved.png" alt="Mosaic" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/map"><b>Map</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/map_solved.png" alt="Map" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/pearl"><b>Pearl</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/pearl_solved.png" alt="Pearl" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/bridges"><b>Bridges</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/bridges_solved.png" alt="Bridges" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/inertia"><b>Inertia</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/inertia_unsolved.png" alt="Inertia" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/guess"><b>Guess</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/guess_3.png" alt="Guess" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range"><b>Chess Range</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/chess_range_unsolved.png" alt="Chess Range" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range"><b>Chess Solo</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/chess_solo_unsolved.png" alt="Chess Solo" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/chess_range"><b>Chess Melee</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/chess_melee_unsolved.png" alt="Chess Melee" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/thermometers"><b>Thermometers</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/thermometers_solved.png" alt="Thermometers" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/aquarium"><b>Aquarium</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/aquarium_solved.png" alt="Aquarium" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/stitches"><b>Stitches</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/stitches_solved.png" alt="Stitches" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/battleships"><b>Battleships</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/battleships_solved.png" alt="Battleships" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/kakurasu"><b>Kakurasu</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/kakurasu_solved.png" alt="Kakurasu" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/star_battle"><b>Star Battle</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/star_battle_solved.png" alt="Star Battle" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/star_battle"><b>Star Battle Shapeless</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/star_battle_shapeless_solved.png" alt="Star Battle Shapeless" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/lits"><b>Lits</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/lits_solved.png" alt="Lits" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/black_box"><b>Black Box</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/black_box_solved.png" alt="Black Box" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/galaxies"><b>Galaxies</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/galaxies_solved.png" alt="Galaxies" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/slant"><b>Slant</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/slant_solved.png" alt="Slant" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/unequal"><b>Unequal</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/unequal_solved.png" alt="Unequal" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/norinori"><b>Norinori</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/norinori_solved.png" alt="Norinori" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/slitherlink"><b>Slitherlink</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/slitherlink_solved.png" alt="Slitherlink" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/yin_yang"><b>Yin-Yang</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/yin_yang_solved.png" alt="Yin-Yang" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/binairo"><b>Binairo</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/binairo_solved.png" alt="Binairo" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/rectangles"><b>Rectangles</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/rectangles_solved.png" alt="Rectangles" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/palisade"><b>Palisade</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/palisade_solved.png" alt="Palisade" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/flip"><b>Flip</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/flip_unsolved.png" alt="Flip" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/nurikabe"><b>Nurikabe</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/nurikabe_solved.png" alt="Nurikabe" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/heyawake"><b>Heyawake</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/heyawake_solved.png" alt="Heyawake" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/shingoki"><b>Shingoki</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/shingoki_solved.png" alt="Shingoki" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/tapa"><b>Tapa</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/tapa_solved.png" alt="Tapa" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/binairo"><b>Binairo Plus</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/binairo_plus_solved.png" alt="Binairo Plus" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/shakashaka"><b>Shakashaka</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/shakashaka_solved.png" alt="Shakashaka" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/kakuro"><b>Kakuro</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/kakuro_solved.png" alt="Kakuro" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/sudoku"><b>Sudoku Jigsaw</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/sudoku_jigsaw_solved.png" alt="Sudoku Jigsaw" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/sudoku"><b>Sudoku Killer</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/sudoku_killer_solved.png" alt="Sudoku Killer" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/flood_it"><b>Flood It</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/flood_it_unsolved.png" alt="Flood It" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/pipes"><b>Pipes</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/pipes_solved.png" alt="Pipes" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/connect_the_dots"><b>Connect the Dots</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/connect_the_dots_solved.png" alt="Connect the Dots" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/nonograms"><b>Nonograms Colored</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/nonograms_colored_solved.png" alt="Nonograms Colored" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/abc_view"><b>ABC View</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/abc_view_solved.png" alt="ABC View" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/mathema_grids"><b>Mathema Grids</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/mathema_grids_solved.png" alt="Mathema Grids" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/split_ends"><b>Split Ends</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/split_ends_solved.png" alt="Split Ends" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/n_queens"><b>N-Queens</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/7_queens_solved.png" alt="N-Queens" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/troix"><b>Troix</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/troix_solved.png" alt="Troix" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/troix"><b>Dumplings</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/dumplings_solved.png" alt="Dumplings" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/hidoku"><b>Hidoku</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/hidoku_solved.png" alt="Hidoku" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/suko"><b>Suko</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/suko_solved.png" alt="Suko" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/suguru"><b>Suguru</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/suguru_solved.png" alt="Suguru" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/number_path"><b>Number Path</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/number_path_solved.png" alt="Number Path" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/yajilin"><b>Yajilin</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/yajilin_solved.png" alt="Yajilin" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/numbermaze"><b>Number Maze</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/numbermaze_solved.png" alt="Number Maze" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/link_a_pix"><b>Link-a-Pix</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/link_a_pix_solved.png" alt="Link-a-Pix" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/trees_logic"><b>Trees Logic</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/trees_logic_solved.png" alt="Trees Logic" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/vectors"><b>Vectors</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/vectors_solved.png" alt="Vectors" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/vermicelli"><b>Vermicelli</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/vermicelli_solved.png" alt="Vermicelli" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/cow_and_cactus"><b>Cow and Cactus</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/cow_and_cactus_solved.png" alt="Cow and Cactus" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/kropki"><b>Kropki</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/kropki_solved.png" alt="Kropki" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/ripple_effect"><b>Ripple Effect</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/ripple_effect_solved.png" alt="Ripple Effect" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/area_51"><b>Area 51</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/area_51_solved.png" alt="Area 51" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/circle_9"><b>Circle 9</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/circle_9_solved.png" alt="Circle 9" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/kakuro"><b>Krypto Kakuro</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/krypto_kakuro_solved.png" alt="Krypto Kakuro" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/snail"><b>Snail</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/snail_solved.png" alt="Snail" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/hidden_stars"><b>Hidden Stars</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/hidden_stars_solved.png" alt="Hidden Stars" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/branches"><b>Branches</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/branches_solved.png" alt="Branches" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/tatami"><b>Tatami</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/tatami_solved.png" alt="Tatami" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/linesweeper"><b>Linesweeper</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/linesweeper_solved.png" alt="Linesweeper" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/clouds"><b>Clouds</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/clouds_solved.png" alt="Clouds" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/walls"><b>Walls</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/walls_solved.png" alt="Walls" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/rooms"><b>Rooms</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/rooms_solved.png" alt="Rooms" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/mathrax"><b>Mathrax</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/mathrax_solved.png" alt="Mathrax" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/arrows"><b>Arrows</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/arrows_solved.png" alt="Arrows" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/sumscrapers"><b>Sumscrapers</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/sumscrapers_solved.png" alt="Sumscrapers" width="140">
    </a>
  </td>
</tr>
<tr>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/tenner_grid"><b>Tenner Grid</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/tenner_grid_solved.png" alt="Tenner Grid" width="140">
    </a>
  </td>
  <td align="center">
    <a href="https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/archipelago"><b>Archipelago</b><br><br>
      <img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/archipelago_solved.png" alt="Archipelago" width="140">
    </a>
  </td>
</tr>

<!-- AUTO-GENERATED GALLERY END -->
</table>

</div>

---

## Introduction

The aim of this repo is to provide very efficient solvers (i.e. not brute force solvers) for countless (90+) popular pencil logic puzzles like Nonograms, Sudoku, Minesweeper, and many more lesser known ones.

If you happen to have a puzzle similar to the ones listed below and want to solve it (or see how many potential solutions a partially covered board has), then this repo is perfect for you.

The simple use-case of this repo is if you want to solve a puzzle given the state of the board. But the other interesting use-cases is if you want to check if removing a clue would still result in a unique solution or would make the puzzle ambiguous and have multiple solutions.

**Why?** There are countless python packages that can solve the popular puzzles below, so a valid question to ask is **why would I want to use this package and why did you create it?**. The answer is that there are multiple problems with most of those packages which this package solves which are:

1. **Sophisticated solvers:** A lot of available online solvers are incredibly inefficient as they implement naive algorithms that brute force and backtrack through all possible solutions. This package solves that issue as all the solvers included here never use naive algorithms and instead use a very efficient CP-SAT solver which is a more sophisticated solver than any one person could possibly write.
2. **Numerous puzzles:** Most of the available python solvers are only designed for a single type of puzzle and each one requires a different way to encode the input and extract the solution. This package solves both those issues as this package provides solvers for many puzzles all with a similar interface that encodes the input and extracts the solution in a similar way.
3. **Esoteric puzzles:** Most packages you can find online are only designed for popular puzzles. This package partially solves this issue by providing solvers for many puzzles. I'm open to suggestions for implementing solvers for more puzzles.
4. **All possible solutions:** The available solvers often lack uniqueness checks and simply stop at the first possible solution without verifying uniqueness or completeness. This package supports checking whether puzzles are uniquely solvable, ambiguous, or unsolvable for all the puzzles.

Play most of the puzzles online in the website listed in the [Puzzle List](https://github.com/Ar-Kareem/puzzle_solver/blob/master/images/puzzle_list/README.md).


Almost all the solvers in this repo use the CP-SAT solver from Google OR-Tools.


## Quick Start

Install

```bash
pip install multi-puzzle-solver
```

Use:

```python
from puzzle_solver import nonograms_solver as solver
top_numbers = [[8, 2], [5, 4], [2, 1, 4], [2, 4], [2, 1, 4], [2, 5], [2, 8], [3, 2], [1, 6], [1, 9], [1, 6, 1], [1, 5, 3], [3, 2, 1], [4, 2], [1, 5]]
side_numbers = [[7, 3], [7, 1, 1], [2, 3], [2, 3], [3, 2], [1, 1, 1, 1, 2], [1, 6, 1], [1, 9], [9], [2, 4], [8], [11], [7, 1, 1], [4, 3], [3, 2]]
binst = solver.Board(top=top_numbers, side=side_numbers)
solutions = binst.solve_and_print()
```

Output:

```python
Solution found
[['B' 'B' 'B' 'B' 'B' 'B' 'B' ' ' 'B' 'B' 'B' ' ' ' ' ' ' ' ']
 ['B' 'B' 'B' 'B' 'B' 'B' 'B' ' ' ' ' ' ' ' ' ' ' 'B' ' ' 'B']
 ['B' 'B' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'B' 'B' 'B' ' ']
 ['B' 'B' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'B' 'B' 'B']
 ['B' 'B' 'B' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'B' 'B']
 ['B' ' ' ' ' ' ' 'B' ' ' 'B' ' ' ' ' 'B' ' ' ' ' ' ' 'B' 'B']
 ['B' ' ' ' ' ' ' ' ' ' ' 'B' 'B' 'B' 'B' 'B' 'B' ' ' ' ' 'B']
 ['B' ' ' ' ' ' ' ' ' ' ' 'B' 'B' 'B' 'B' 'B' 'B' 'B' 'B' 'B']
 [' ' ' ' ' ' ' ' ' ' 'B' 'B' 'B' 'B' 'B' 'B' 'B' 'B' 'B' ' ']
 [' ' ' ' ' ' ' ' ' ' 'B' 'B' ' ' 'B' 'B' 'B' 'B' ' ' ' ' ' ']
 [' ' ' ' ' ' ' ' 'B' 'B' 'B' 'B' 'B' 'B' 'B' 'B' ' ' ' ' ' ']
 ['B' 'B' 'B' 'B' 'B' 'B' 'B' 'B' 'B' 'B' 'B' ' ' ' ' ' ' ' ']
 ['B' 'B' 'B' 'B' 'B' 'B' 'B' ' ' ' ' 'B' ' ' 'B' ' ' ' ' ' ']
 [' ' 'B' 'B' 'B' 'B' ' ' ' ' ' ' ' ' 'B' 'B' 'B' ' ' ' ' ' ']
 [' ' 'B' 'B' 'B' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'B' 'B' ' ' ' ']]
Solutions found: 1
status: OPTIMAL
Time taken: 0.04 seconds
```
(Note: Printing can be turned off by setting `verbose=False`)

## Table of Contents

- [Python Puzzle Solver](#python-puzzle-solver)
  - [Install](#install)
  - [🕹️ Puzzle Gallery](#️-puzzle-gallery)
  - [Introduction](#introduction)
  - [Quick Start](#quick-start)
  - [Table of Contents](#table-of-contents)
- [Puzzles](#puzzles)
  - [Sudoku (Puzzle Type #2)](#sudoku-puzzle-type-2)
  - [Filling (Puzzle Type #7)](#filling-puzzle-type-7)
  - [Singles (Puzzle Type #10)](#singles-puzzle-type-10)
  - [Range (Puzzle Type #13)](#range-puzzle-type-13)
  - [Tracks (Puzzle Type #16)](#tracks-puzzle-type-16)
  - [Pearl (Puzzle Type #19)](#pearl-puzzle-type-19)
  - [Inertia (Puzzle Type #21)](#inertia-puzzle-type-21)
  - [Guess (Puzzle Type #22)](#guess-puzzle-type-22)
  - [Chess Melee (Puzzle Type #25)](#chess-melee-puzzle-type-25)
  - [Aquarium (Puzzle Type #27)](#aquarium-puzzle-type-27)
  - [Stitches (Puzzle Type #28)](#stitches-puzzle-type-28)
  - [Battleships (Puzzle Type #29)](#battleships-puzzle-type-29)
  - [Star Battle Shapeless (Puzzle Type #32)](#star-battle-shapeless-puzzle-type-32)
  - [Lits (Puzzle Type #33)](#lits-puzzle-type-33)
  - [Galaxies (Puzzle Type #35)](#galaxies-puzzle-type-35)
  - [Slitherlink (Puzzle Type #39)](#slitherlink-puzzle-type-39)
  - [Rectangles (Puzzle Type #42)](#rectangles-puzzle-type-42)
  - [Palisade (Puzzle Type #43)](#palisade-puzzle-type-43)
  - [Heyawake (Puzzle Type #46)](#heyawake-puzzle-type-46)
  - [Shingoki (Puzzle Type #47)](#shingoki-puzzle-type-47)
  - [Shakashaka (Puzzle Type #50)](#shakashaka-puzzle-type-50)
  - [Sudoku Killer (Puzzle Type #53)](#sudoku-killer-puzzle-type-53)
  - [Flood It (Puzzle Type #54)](#flood-it-puzzle-type-54)
  - [Pipes (Puzzle Type #55)](#pipes-puzzle-type-55)
  - [Connect the Dots (Puzzle Type #56)](#connect-the-dots-puzzle-type-56)
  - [Nonograms Colored (Puzzle Type #57)](#nonograms-colored-puzzle-type-57)
  - [Split Ends (Puzzle Type #60)](#split-ends-puzzle-type-60)
  - [N-Queens (Puzzle Type #61)](#n-queens-puzzle-type-61)
  - [Suguru (Puzzle Type #66)](#suguru-puzzle-type-66)
  - [Yajilin (Puzzle Type #68)](#yajilin-puzzle-type-68)
  - [NumberMaze (Puzzle Type #69)](#numbermaze-puzzle-type-69)
  - [Link-a-Pix (Puzzle Type #70)](#link-a-pix-puzzle-type-70)
  - [Vectors (Puzzle Type #72)](#vectors-puzzle-type-72)
  - [Vermicelli (Puzzle Type #73)](#vermicelli-puzzle-type-73)
  - [Cow and Cactus (Puzzle Type #74)](#cow-and-cactus-puzzle-type-74)
  - [Ripple Effect (Puzzle Type #76)](#ripple-effect-puzzle-type-76)
  - [Area 51 (Puzzle Type #77)](#area-51-puzzle-type-77)
  - [All other Puzzles](#all-other-puzzles)
    - [Aliases](#aliases)
- [Other](#other)
  - [Why SAT / CP-SAT?](#why-sat--cp-sat)
  - [Testing](#testing)
  - [Contributing](#contributing)
    - [Build and push to PyPI](#build-and-push-to-pypi)

---

# Puzzles

Each puzzle in this repo have a simple example input board followed by the code to utilize this package and solve the puzzle, followed by the scripts output, and finally the solved puzzle.

Some of the puzzles implemented are shown below. 

## Sudoku (Puzzle Type #2)

Also known as Number Place or Solo. 

The code can:

1. Solve arbitrarily sized valid board sizes, thus can be used to solve:
   - Hex Sudoku (a 16x16 variant) 
   - Kidoku (a kid-friendly sudoku variant)
2. Solve the ["Sandwich" sudoku variant](https://dkmgames.com/SandwichSudoku/) using the optional parameter `sandwich={'side': [...], 'bottom': [...]}`
3. Solve the ["Sudoku-X" variant](https://www.sudopedia.org/wiki/Sudoku-X) using the optional parameter `unique_diagonal=True`

* [**Play online**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/solo.html)

* [**Instructions**](https://www.chiark.greenend.org.uk/~sgtatham/puzzles/doc/solo.html#solo)

* [**Solver Code**](https://github.com/Ar-Kareem/puzzle_solver/tree/master/src/puzzle_solver/puzzles/sudoku)

<details>
  <summary><strong>Rules</strong></summary>

You have a square grid, which is divided into as many equally sized sub-blocks as the grid has rows. Each square must be filled in with a digit from 1 to the size of the grid, in such a way that

  - every row contains only one occurrence of each digit
  - every column contains only one occurrence of each digit
  - every block contains only one occurrence of each digit.

You are given some of the numbers as clues; your aim is to place the rest of the numbers correctly.

</details>

**Unsolved puzzle**

<img src="https://raw.githubusercontent.com/Ar-Kareem/puzzle_solver/master/images/puzzles/sudoku_unsolved.png" alt="Sudoku unsolved" width="500">

Code to utilize this package and solve the puzzle:

```python
import numpy as np
from puzzle_solver import sudoku_solver as solver
board = np.array([
  [' ', '7', '5', '4',  '9', '1', 'c', 'e',  'd', 'f', ' ', ' ',  '2', ' ', '3', ' '],
  [' ', ' ', ' ', ' ',  'f', 'a', ' ', ' ',  ' ', '6', ' ', 'c',  ' ', ' ', '8', 'b'],
  [' ', ' ', '1', ' ',  ' ', '6', ' ', ' ',  ' ', '9', ' ', ' ',  ' ', 'g', ' ', 'd'],
  [' ', '6', ' ', ' ',  ' ', ' ', ' ', ' ',  ' ', ' ', '5', 'g',  'c', '7', ' ', ' '],

  ['4', 'a', ' ', ' ',  ' ', ' ', ' ', ' ',  ' ', ' ', ' ', '9',  ' ', ' ', ' ', ' '],
  [' ', 'g', 'f', ' ',  'e', ' ', ' ', '5',  '4', ' ', ' ', '1',  ' ', '9', ' ', '8'],
  [' ', ' ', ' ', ' ',  'a', '3', 'b', '7',  'c', 'g', ' ', '6',  ' ', ' ', ' ', '4'],
  [' ', 'b', ' ', '7',  ' ', ' ', ' ', ' ',  'f', ' ', '3', ' ',  ' ', 'a', ' ', '6'],

  ['2', ' ', 'a', ' ',  ' ', 'c', ' ', '1',  ' ', ' ', ' ', ' ',  '7', ' ', '6', ' '],
  ['8', ' ', ' ', ' ',  '3', ' ', 'e', 'f',  '7', '5', 'c'