
128 9. Navigating Objects
from the origin over all moves and retrieve one node for every move. As
soon as a queue is empty, the next one is filled until they are all used up.
Sometimes a look at the data (structures) is more helpful than the pseu-
docode. The graph is transformed into a tree view from the origin’s per-
spective:
graph -> tree view -> collection view -> move loop
currPath[] queues[]
origin: 1 move#: 1 2 3 [0] = origin
move# / | \ : 1 2 5 11 [1] = [0]
1 2 3 4 currPath 1 2 6 X :
/| / \ |\ : 1 3 7 12 [2] = [1]
2 5 6 7 8 9 10 : : : : : :
| / \ | | \ : 1 4 10 16 [moves] =
3 11 12 13 14 15 16 path [0][1][2][3] [moves-1]
The GameMap implementation ...