| Algorithm 2. Avoid Past Pseudocode. |
| AvoidingPastAngle = 0; |
| Evaluate the neighbor waypoints according to current heading angle; |
| if Neighbor Waypoint at the Center is Free and Unvisited then |
| AvoidingPastAngle = 0; |
| else |
| if Neighbor Waypoint at the Left is Free and Unvisited then |
| AvoidingPastAngle = 45; |
| else |
| if Neighbor Waypoint at the Right is Free and Unvisited then |
| AvoidingPastAngle = −45; |
| else |
| AvoidingPastAngle = an angle between −115 and 115 according to visit counts proportions of the left, center and right neighbor waypoints; |
| end |
| end |
| end |
| return AvoidingPastAngle; |