Pythonified while loop
Finished findPathToClosestDot