Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 1.78 KB

README.md

File metadata and controls

30 lines (19 loc) · 1.78 KB

15-Puzzle Solver

Inspired by and modeled after the 8-puzzle assignment from the (free!) Princeton Algorithms Coursera course. This is an exercise in implementing the concepts, and adding some goofy backgrounds. :)

A 3x3 or 4x4 slider puzzle can be shuffled and solved. The solver can be paused any time by hitting "Stop" during playback. You can also just play the game normally.

The solver uses the A* algorithm to explore possible moves. It uses manhattan distance plus linear conflicts to prioritize moves. Note this implementation is not efficient enough for 5x5 boards.

The shuffler uses the Fisher-Yates shuffle to permute the tiles, then checks whether the board is solvable by counting the number of inversions (using mergesort). If the generated board is not solvable, it swaps two adjacent non-zero tiles to place it in the solvable equivalence class.

Attribution

Development

Production

  • yarn run build
  • yarn run deploy