Has anyone got an algorithm (preferably easy to understand!) that will calculate the line-of-sight path {1} between two Battletech hexes? I'm not looking for the algorithm to do anything fancy, like take the underlying terrain on the map(s) into account - I just want to know what the valid path is (or paths are) between two hexes without having to put a piece of string between two hexes on a mapboard :)
I've tried googling for this, and while there are several very good resources out there for doing hex line-of-sight calculations (such as
http://www.redblobgames.com/grids/hexagons/), they either use map boards that don't use the same co-ordinate system the BattleTech maps do (and I'd really like to avoid having to convert between two different co-ordinate systems {2}), or the maths does my head in (especially when one solution talks about turning the 2D map board into a 3D cube...ugh!).
{1} Or paths, for those instances where there might be 2 (or more) equally valid paths between two hexes.
For example, when calculating the path between hex 0605 and hex 1005 the paths:
0605 -> 0705 -> 0805 -> 0905 -> 1005
and
0605 -> 0706 -> 0805 -> 0906 -> 1005
are equally valid (and as a side note, one would assume that 0605 -> 0705 -> 0805 -> 0906 -> 1005 would be
invalid, since the path either has to favour either all the "above the line" hexes OR all the "below the line" hexes when faced with a choice between two hexes for its path (hope that makes sense!))
{2} In the late 90's, in an effort to teach myself C, I used the algorithm written by Clark Verbrugge {3} to solve this problem, applying a transformation function to convert his hex co-ordinate system to the one Battletech maps use. Unfortunately, looking at the code now, my C code is pretty much "write only"...
{3} See
http://www.sable.mcgill.ca/~clump/research.html