Correctly resolve to furthest node

The node sorting for the AI to select the node furthest from the player
was incorrect, but now correctly selects the furthest node. Many of the
method names and implementations have been tidied up as well.