AlgoViz

A* Algorithm (8-Puzzle) Visualization

Speed:
Heuristic:
Steps
0/0
Nodes Explored
0
Current Heuristic
1
1
2
3
4
5
6
7
8
Click a tile next to the empty space to move it

Search Tree Visualization

How It Works

A* (A-Star) is an informed search algorithm that finds the shortest path from a start state to a goal state:

  1. It uses a heuristic function to estimate the cost from the current state to the goal
  2. For each state, it calculates f(n) = g(n) + h(n), where g(n) is the cost so far and h(n) is the heuristic estimate
  3. States are explored in order of their f-value (lowest first)
  4. The algorithm is guaranteed to find the optimal solution when using an admissible heuristic

Interactive Features

  • Move tiles manually by clicking adjacent to the empty space
  • Generate random puzzles to test different scenarios
  • Toggle between Manhattan distance and Misplaced tiles heuristics
  • Watch the algorithm find the optimal solution step by step
  • Use setup mode to create custom puzzles by swapping tiles