all projects

// project 08 / 08

A-Star Pathfinding Visualizer

Watch algorithms find their way.

An introduction to data structures and algorithms in python. Created a visualizer for the A-Star algorithm using pygame.

astar-visualizer.app
A-Star Pathfinding Visualizer screenshot
year
2023
role
Solo developer
context
Personal project
status
Completed

A*

search algorithm

Live

step-by-step drawing

1

priority queue

∞

mazes to draw

// the story

“Watch algorithms find their way.”

This was my hands-on introduction to data structures and algorithms. Instead of reading about A*, I built a tool to watch it think.

Draw walls on a grid, drop a start and an end point, and the visualizer animates A* exploring the grid and tracing the shortest path it finds.

  • Built an interactive grid in Pygame where you place a start node, an end node and barriers, then watch A* search for the shortest path step by step.
  • Implemented A* with a priority queue and a distance heuristic, highlighting open, closed and final-path nodes as the search runs.

// what it does

Features that matter.

Shortest paths

A* finds the shortest route around any barriers you draw.

01

Animated search

Open, closed and path nodes are colored as the algorithm runs.

02

Draw your own maze

Click to place the start, the end and walls anywhere on the grid.

03

Heuristic-guided

A distance heuristic steers the search toward the goal.

04

// how it's wired

Under the hood.

Input

Mouse & keyboard

Place nodes, start the search

Algorithm

A* search

Priority queue + heuristic

Rendering

Pygame grid

Animated node states

// built with

The stack.

Language

  • Python

Graphics

  • Pygame

Concepts

  • Algorithms
  • Data Structures
~/astar-visualizer

$ git clone github.com/vineet-panchal/astar-visualizer

$ cd astar-visualizer

// loading stack...

Python

Pygame

Algorithms

Data Structures

✓ 4 technologies ready

// build log

How it came together.

  1. 01

    The grid

    Drew a clickable grid of nodes in Pygame.

  2. 02

    The algorithm

    Implemented A* with a priority queue and heuristic.

  3. 03

    Animation

    Colored nodes as they open, close and join the final path.

// problems solved

Hard parts, handled.

Seeing the search

// problem

An algorithm that finishes instantly teaches nothing.

// solution

The search redraws the grid on every step, so you can follow its decisions.

// next project

Lune

Every satellite, live, in your browser.