chickadee » hexgrid » distance

grid-size cell1 cell2procedure

Return how many steps does it take to go from cell1 to cell2, where a step means moving to an adjacent cell. Provide a valid width and/or height in grid-size if you want to allow wrapping around that direction, or #f in the respective position otherwise. For example ((distance '(5 #f)) '(1 2) '(3 4)) will wrap horizontally assuming the grid has width 5, and it will not wrap vertically at all. Bounds are not checked in any case. Use within-bounds? if you want that.

(Note: curried.)