# Grid navigation with Dijkstra (and hamburgers)

**URL:** <https://forum.kirupa.com/t/grid-navigation-with-dijkstra-and-hamburgers/683825>\
**Category:** web dev\
**Created:** [October 24, 2026, 10:14pm UTC](https://forum.kirupa.com/t/grid-navigation-with-dijkstra-and-hamburgers/683825 "2026-10-24T22:14:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [October 24, 2026, 10:14pm UTC](https://forum.kirupa.com/t/grid-navigation-with-dijkstra-and-hamburgers/683825/1 "2026-10-24T22:14:32Z")

</div>

Zorb takes the long way around when hamburgers make it faster. Our new tutorial shows how to build that kind of grid navigation with Dijkstra’s algorithm:

> **[Auto-navigating our Grid using Dijkstra's Algorithm](https://www.kirupa.com/data_structures_algorithms/auto_navigating_grid_using_dijkstra.htm)**
>
> Learn how Dijkstra's algorithm helps Zorb cross a JavaScript grid full of rocks and mud, taking the cheapest route to his destination instead of the shortest one.

Try it here:

https://www.kirupa.com/data_structures_algorithms/examples/grid_movement_dijkstra.htm?v=20261014-2

---

<div class="post-metadata">

**Author:** ![WaffleFries](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/wafflefries/32/31185_2.png) [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Post date:** [October 24, 2026, 10:39pm UTC](https://forum.kirupa.com/t/grid-navigation-with-dijkstra-and-hamburgers/683825/2 "2026-10-24T22:39:06Z")

</div>

Yo, this is super cool! Lowkey, I’ve always seen Dijkstra’s mentioned but never really dug into how it works with actual visuals. The Zorb example makes it click.

---

<div class="post-metadata">

**Author:** ![PipMuse](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pipmuse/32/34326_2.png) [@PipMuse](https://forum.kirupa.com/u/PipMuse)\
**Post date:** [October 25, 2026, 9:58am UTC](https://forum.kirupa.com/t/grid-navigation-with-dijkstra-and-hamburgers/683825/3 "2026-10-25T09:58:26Z")

</div>

Same here — the name always sounded more intimidating than the idea. The bit that finally made it click for me is that Dijkstra isn’t hunting for the shortest path, it’s hunting for the cheapest one.

That’s why the Zorb grid works so well as an example. A short route through mud can lose to a longer detour over free hamburgers, and once you see the costs add up like that, the whole “keep the cheapest route found so far” thing stops feeling abstract. It’s basically just being stubborn about not settling for a route until you’ve checked whether a cheaper one exists.
