a java solution to the honeycomb puzzle
I recently saw a puzzle online that seemed rather interesting to solve. Given a hexagon labelled "1", place a hexagon labelled "2" on its southern edge, then continue to place hexagons in a clockwise fashion around "1", binding to clockwise neighboring hexagons until you reach some arbitrary number like 70 (the layout is spiral in appearance). Here is the visual the puzzle-crafters provided:
Given that, find the distance between any two hexagons in the honeycomb layout. For this I opted to use a breadth-first search, although the initial layout of the hexagons proved to be more interesting from a programming perspective.
gistlast update 2013-12-04