Tuna Gül

Systems

Path-Finding Archive

A grid path-finding visualiser in pygame: draw walls, place a start and an end, and watch an A*-style search spread out and trace the path.

Role
Author
Period
Sep–Oct 2020
Team
Solo
Stack
Python · pygame

Code ↗

Path-Finding

What I did

A weekend project: a pygame grid where the first click places the start, the second the end, and the rest draw walls (right click erases); space starts the search. It comes with a few ready-made wall maps.

How it works

  • Every cell keeps the length of the best path found to it and the cell it came from.
  • On every step the open cells are sorted by path length plus straight-line distance to the end, the idea behind A*, and the best one is expanded to its four neighbours.
  • Expanded cells turn blue and the frontier green; when the end is reached, the path is traced back in orange.
  • I also tried a Cython build of the board for speed.

Gallery

Animation: blue explored cells and a green frontier spread from the start until an orange path reaches the red end.
Illustration of the method, redrawn for this page in the program's own colours. Not a screenshot of the original.