Book a free demo

๐Ÿ’ป Coding games ยท free, no sign-up

Pathfinding: find a way through.

Play Pathfinding Visualizer

Loading Pathfinding Visualizerโ€ฆ

Add walls and watch breadth-first search explore the grid from S to G before tracing a shortest route.

ShareWhatsApp

How to play Pathfinding Visualizer

  1. Click empty cells to add or remove walls.
  2. Keep the start and finish cells clear.
  3. Press Find path to run breadth-first search.
  4. Clear the route or make a new maze and compare.

Tips and strategy

  • The search checks nearby cells before moving farther away.
  • A wall blocks movement; a longer route may be the only route.
  • If no path appears, remove some walls and try again.

Learn beyond the game

Explore the idea behind Pathfinding Visualizer

Worked example

On an open 3ร—3 grid, start in the top-left corner and aim for the bottom-right. Breadth-first search checks cells one move away, then two moves away. The first time it reaches the goal, it can trace back a route with four moves.

Common sticking point

Visited cells show where the search looked; they are not all part of the final route. Breadth-first search may explore several branches before it can prove that a shortest route has been found.

Try it away from the screen

Draw a 5ร—5 grid, add a few walls, and use scraps of paper as a queue. Put the start cell in first, then add each open neighbour once. Mark the distance layer as you go.

Mini challenge

On a 3ร—3 grid, block only the centre cell. From the top-left to the bottom-right, what is the shortest distance, and how many shortest routes avoid the wall?

Show the answer

The shortest distance is four moves. Two shortest routes avoid the centre: go across the top then down, or down the left side then across the bottom.

How to use this practice path

Run the search on the ready-made maze, then add one wall at a time and compare how many cells are visited. For a different algorithmic idea, try the Sorting Visualizer.

Where the idea goes next

This grid gives every move the same cost. When routes have different costs, algorithms such as Dijkstra's search keep track of the total cost as well as the number of steps.

Keep playing

More games you might like

All 116 games โ†’

FAQ

Pathfinding Visualizer: questions

Is this the same as Google Maps?

No. It is a small grid demonstration of breadth-first search; real maps include roads, travel time and many other constraints.

Can I draw my own maze?

Yes. Click cells to place or remove walls, then run the search.

Start a conversation

Questions about classes?

A parent or guardian can share the learner's age, level and goals, and we'll suggest a starting point and confirm the format before anything is booked.

  • Tell us the learnerโ€™s age or grade and goals
  • Weโ€™ll suggest a suitable class or learning path
  • Weโ€™ll confirm format, timing and fees with a parent or guardian

For a childโ€™s class, please have a parent or guardian send the enquiry. Avoid sharing passwords or sensitive personal details.

Weโ€™ll use your details only to respond to this request.

Chat on WhatsApp
Esc

Try