Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Say I have this map:

Hex Map with Coordinates

The first two digits on each hex represent the X axis, the last two digits the Y axis, with 60º between both.

How do I calculate the shortest distance between two hexes? E.g. the distance between (01,01) and (07,02) is 6. The distance between (02,08) and (04,04) is 5.

Preferably without a conditional algorithm, of which I've seen a couple... All the coordinates being positive will hopefully make it simpler.

share|cite|improve this question

migrated from Jul 15 '12 at 21:04

This question came from our site for gamemasters and players of tabletop, paper-and-pencil role-playing games.

Why not just count how many hexes you have to move to get from point 1 to point 2 on a shortest path? Yes, it will pad the distance in certain cases (01,01 to 07,02 becomes 7 rather than 6), but it's simple. – Oblivious Sage Jul 15 '12 at 16:46
This definitely needs to be migrated. The answers require non-RPG math or programming expertise, hence it belongs where such experts are found, not here. – SevenSidedDie Jul 15 '12 at 17:53
Can you explain what you mean by a "conditional algorithm" that you don't want? An explicit formula will probably need a few cases, but can be done without a full-fledged graph search. – Rahul Jul 15 '12 at 21:12
By conditional I mean that I've seen a couple algorythms meant for programming languages; e.g. "if (x>y) then foo; else bar;". If at all possible, I'd like to have a direct formula to calculate the distance. – willf Jul 16 '12 at 8:00

Personally, I've just used a piece of string. The hex grid is (typically) 1 inch. Characters can go wherever they want, as long as the distance is less than their movement. How do I measure? I take the string and measure along the side of the map grids.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.