All algorithms

Informed search · 6 min read

Dijkstra's Algorithm

Lowest-cost route, still no target sense. A priority queue ordered by accumulated cost, including soft patrol risk, still without aiming at the exit.

Why this category

Search that orders expansion using extra knowledge: path cost (including soft patrol risk), straight-line distance to the exit, jump pruning, or both.

How it explores

Exploring: 2 of 47 states checked

expandedwallhazardroute

Why it is Informed

Dijkstra's Algorithm generalises Breadth-First Search to weighted edges. In textbooks it is often grouped with uninformed search because it has no goal heuristic. Here it is Informed because the priority uses domain knowledge beyond topology: each step costs one tick plus a soft penalty when you stand near a patrol lane.

Dijkstra's Algorithm still does not aim at the exit. That is why its explore wash is often wider than Greedy Best-First Search or A* Search. The information is about cost, not about target direction.

How it picks the next move

Priority queue keyed by accumulated cost. Pop the cheapest state so far. Exit means reconstruct path. Neighbours at tick + 1 must be walkable, unvisited, and not in the learned "x,y,phase" set. Edge cost is 1 + riskPenalty, where riskPenalty rises when a guard's patrol position that tick is within vision range of the cell. Push if this arrival is cheaper than any known cost for that space-time state.

Hard bans (learned deaths) remove edges entirely. Soft risk only nudges the ranking. Dijkstra's Algorithm can still walk near a guard if every cheaper option is blocked.

What it stores after a fail

Same calendar model: "x,y,phase" keys from the catching cone. Next plan cannot enter those slots. Soft risk is recomputed from patrol timelines every attempt. It is not the same thing as memory. Memory is only the blacklist from real catches.

If a tile is deadly at phase 6 and free at phase 10, Dijkstra's Algorithm may spend extra ticks elsewhere so it arrives at phase 10. That retiming shows up as a longer route that still uses the same corridor.

More informed search

Try it live

Run this algorithm on a built-in level, or paint your own grid and guards.