I am just wanting to let you know that I ran into an issue when running the bredth firstt algorithm the way that we have it at the end of the lecture. It was still queing neighbors multiple times because it doesn’t mark them as explored until all the neighbors have been visited. I noticed that with your collapsed terminal there were multiples of the neighbors being queued. I fixed this issue by add changing my QueueNewNeighbors method to:
private void QueueNewNeighbors(Vector2Int neighborCoordinates)
{
Waypoint neighbor = grid[neighborCoordinates];
if (neighbor.isExplored)
{
//do nothing
}
else
{
neighbor.SetTopColor(Color.grey);
if (queue.Contains(neighbor))
{
}
else
{
queue.Enqueue(neighbor);
print("Queueing neighbor " + neighbor);
}
}
}
If there was no need for this please let me know because I have been chasing down why it keeps queing neighbors that are already queued.
I’m loving the lectures btw. Great material!