P-001

N-Puzzle AI Solver demo

Python A* / IDA* Algorithms

N-Puzzle Solver

Sliding tile puzzles · A* Search · Manhattan + Linear Conflict

Select Puzzle Type

Difficulty

Initial State

[OK] Puzzle is solvable

Solving...

Running A* Search algorithm...

Please wait.

Solved! [OK]

Moves: 0
Nodes Expanded: 0
Execution Time: 0 ms

Step-by-Step

Start 0 / 0 Goal

<- -> arrows · Space = next

First & Last

Initial State

0 intermediate moves

Goal State

Original PyGame Version

The web demo above allows you to explore the solver algorithm. However, the original project was built in Python using PyGame. This native application provides a full interactive interface for creating, shuffling, and visualizing the N-Puzzle solver steps. Below is a preview of the desktop application and its outputs.

Algorithms & Features

The Python solver engine includes advanced techniques for finding optimal paths:

  • A* Search: Efficiently finds shortest path by keeping track of explored nodes.
  • IDA* Search: Optimizes memory consumption, making it feasible to solve larger instances like the 24-puzzle.
  • Heuristics: Implements Manhattan Distance as the base, and adds Linear Conflict to penalize tiles in the correct row/column but wrong order.