Code
- Player.cs
Algorithm
- Breadth First Search
- Start at the root node
- Navigate to adjacent nodes first
- BFS shortest Path Algorithm
- Use Queue
- Enqueue start root, looping while not empty
- Dequeue in loop
- If the node is not visited, change to be visited
- Save parent node, reverse
Queue
- Enqueue
- Insert new node to last
- Dequeue
- Pop first node
List
- Reverse
- Reverse order of list
Search Path
- deltaY & deltaX
- Can go every direction
- If path faces wall, dequeue
- As a result, only shortest path remains