◈ MAZE SIGNAL

A SMALL MAP. A BETTER QUESTION.

The shortest route
isn’t always the cheapest.

Draw a maze. Change the terrain. Watch Dijkstra and A* find the same optimal cost — with different search footprints.

Your map, two algorithms.

Runs entirely in your browser

Ready. Try the weighted detour, or paint a cell.

Dijkstra

Cost so far · g
Cost —Moves —Expanded —

A*

Cost + estimate · g + h
Cost —Moves —Expanded —
S StartG Goal# Wall9 Entry cost· Explored• Final route

Click or tap a cell to paint. Drag to paint walls or terrain. Use arrow keys to move between cells and Space/Enter to paint. Both panels edit the same map.

Export this map for Python / C

Select and copy the text below. Save it as a plain-text file, then run either CLI solver with that path. This stays up to date when you edit or reset the map.

متن نقشه را کپی و در فایل متنی ذخیره کن؛ همان فایل ورودی نسخهٔ Python و C است. این بخش فقط خروجی می‌دهد و اطلاعاتی ارسال نمی‌کند.

01 / THE TRAP

Four moves can cost 28.

In the default map, crossing three expensive cells takes four moves. Going around takes eight moves and costs only eight. We minimize entry cost, not the number of moves.

02 / THE FAIR COMPARISON

Same map. Same optimal cost.

A* uses Manhattan distance. Every move costs at least one. Both algorithms share the same tie rule: larger cost so far, then smaller cell index. Walls can weaken the heuristic.

03 / READ THE METRIC

Less search ≠ always faster.

Expanded cells count work done by the search. Animation speed is presentation only. This JavaScript demo is separate from the measured Python/C benchmarks in the repository.

فارسی — راهنمای کوتاه

یک نقشه را در هر دو پنل تغییر بده و «Run comparison» را بزن. S شروع و G مقصد است؛ # دیوار است و عدد هر خانه هزینهٔ ورود را نشان می‌دهد. هدف یافتن کم‌هزینه‌ترین مسیر است، حتی اگر طولانی‌تر باشد.

با ابزار Start و Goal ابتدا و انتها را جابه‌جا کن؛ باید در دو خانهٔ جدا باشند. Pause مکث می‌کند و Reset نقشهٔ نمونه را برمی‌گرداند. با تغییر نقشه نتیجهٔ قبلی پاک می‌شود. تعداد گره‌های Expanded معیار جست‌وجو است، نه بنچمارک سرعت Python و C.

06 / COME BACK

Was a second visit useful?

If you used the demo again, tell us why. Actual use matters more than a star. Share return-use feedback →

07 / ENGINEERING NOTE

When should recovery stop?

Recover an incomplete tail, reject complete corruption: a measured Python/C storage experiment. Read the second field note →