Skip to content

Latest commit

 

History

History
22 lines (12 loc) · 1.14 KB

readme.md

File metadata and controls

22 lines (12 loc) · 1.14 KB

slidersolver

A program to solve slider puzzles. Written in C. It should take a few seconds at most to run.

Installation

Open this link in another tab and then run make.

Use

Run the program like ./slidersolver 185423706 123456780 to solve a 3x3 puzzle, and then print out a trace of the solution. (0 is the free space.)

This is made for 8-puzzles, but for larger slider puzzles like the common 15-puzzle you'd have to modify several parts of the program, both constants and logic.

Algorithmic Strategy

This code basically just bruteforces a solution, by exploring and caching the possibility state. There are some optimizations, but only in the form of data structures, not mathematical insights. (Some of the code runs mathematical checks to try to ensure the puzzle is valid, but this does not actually help solve the puzzle.)

Third-Party Tools

  • Make (optional)
  • GCC, or another c compiler (for Make, the other c compiler must be aliased to gcc) (mandatory)