Subtle problem with max_distance
Pathfinding problem!
It helps if you test for *equality* when searching for a goal