I know that we can brute force it by placing an obstacle at every valid position in the path, but is there a more elegant / efficient solution?
I know that we can brute force it by placing an obstacle at every valid position in the path, but is there a more elegant / efficient solution?
You gave me an idea!
(ID, direction)
to(next ID, direction)
(if any) – that is, for each obstacle, update the map entry for any preceding obstacle that could reach it.I think this would give a pretty good speed up, and you might not need to worry about only checking intersections.