Skip to content

shivee-code/n-puzzle-solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

N-Puzzle Solver

A Python implementation of an N-Puzzle solver using A* search with the Manhattan distance heuristic.

Features

  • Supports 3x3 to 5x5 puzzles
  • Finds shortest sequence of moves to solve the puzzle
  • Detects unsolvable states

Input

  • First line: integer k (board size)
  • Next k*k lines: tile numbers (0 represents the empty space)

Output

  • First line: number of moves
  • Following lines: moves (UP, DOWN, LEFT, RIGHT)

Usage

Run with input file:

python3 solver.py < input.txt

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages