Play and solve the n-puzzle with A* Search in C++ using SDL2. (42 Silicon Valley)
You are on macOS with clang++
, make
, and brew
installed.
./setup.sh
Generate a random puzzle of size n
./npuzzle -s n
Load a puzzle from file
./npuzzle -f file
P
Print log of moves.R
Reset the puzzle.Escape
Terminate the program.
Tab
Select next background picture.H
Toggle hint on/off.
Arrow Keys
Slide a tile toward empty position.Backspace
Undo last move.
S
Solve the puzzle.M
Select next search method.K
Select next heuristic function.D
Print diagnostics about current board state.