Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Now we’ll build an alist for the nodes in our city. These nodes may contain the Wumpus or the Glowworms, or they might contain various clues, such as blood, lights, or sirens.
Most of the clues in our game are based on proximity to another node, so we need to write some functions that tell us if two nodes are one node apart in the city graph. The neighbors function looks up the node’s neighbors using the alist of edges. If the second node is in that list, we know we’re one away.