Double exploring waypoints solution

You don’t need to check if
queue.Contains(neighbour)
if the statement
searchCenter.isExplored = true;
is before
ExploreNeighbours(searchCenter);
in the code.
Thanks to this, code is more efficient.

Agreed. I think you can also move the .isExplored = true immediately after you enqueue a waypoint (including the start waypoint), since what that flag is really for is to prevent enqueuing a waypoint more than once. Makes more sense if you call it isVisited or even wasQueued.

Privacy & Terms