Mohamed Amine Hajji / Projects

8-Puzzle Solver — AI Search Visualizer

A Python/Pygame app that both lets you play the 8-puzzle and watches four classic AI search algorithms — BFS, DFS, depth-limited DFS, and A* — solve it step by step.

GitHub

The app has two modes sharing one Node abstraction: Experimental Mode runs a chosen search algorithm — BFS, DFS, depth-limited DFS, or A* — from a fixed start to a fixed goal and animates the solution move-by-move while reporting how many nodes it visited, and Play Mode is the same puzzle made human-playable. All four algorithms are implemented from first principles in plain Python — no search library — and running them on the same instance produced a clear empirical ranking: A* visited by far the fewest nodes thanks to its Hamming-distance heuristic, while depth-limited DFS failed to find a solution at all under a tight depth limit.

Highlights

Stack: Python, Pygame