Pathfinding on a board of six-sided tiles gives odd distances and lopsided routes
Boards made of six-sided tiles do not work with the usual up, down, left, right thinking, and the distance rule you remember from squares gives wrong answers. Here is a coordinate system where counting steps just works.
Why this works
Odd-looking distances come from describing a six-sided board with a square board's rules. A coordinate system that matches the real shape gives every tile the same six neighbours, so distance and routes need no exceptions.
When not to use it
Skip it if your board is square or its tiles are only drawn as hexagons but played in rows and columns. Then the plain square rules fit the game, and a conversion only adds mistakes.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 50 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Pathfinding on a board of six-sided tiles gives odd distances and lopsided routes" (read_entry hex-grid-pathfinding) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP