Algorithm of Wumpus World Agent

-The entire algorithm depends on the agent choosing the next direction based on what it chooses to be the next coordinate.


-It chooses the next coordinate based on the coordinates it knows are definitely safe. These are the only coordinates the agent will choose as the next coordinate since this game involves no risk.


-The list of definitely safe coordinates is added to whenever a robot is standing on or steps on a coordinate. This is because if a robot steps on the coordinate, that coordinate must be safe.


-The agent also keeps track of possible gold, possible Wumpus coordinates and possible pit coordinates. When an agent feels a glitter, breeze or stench all the neighbors of the coordinate it is standing on are appended to the pit and Wumpus coordinate lists respectively.


-If a coordinate was before thought to be Definitely safe but is in the Wumpus or Pit Coordinates, that coordinate is removed from the Definitely safe container.


-If a coordinate is both in Wumpus and Pit Coordinates, that coordinate must be definitely safe and can be removed from the Wumpus/Pit Containers. The only exception is if one of the neighbors of this coordinate has one or more things it can "feel."


-Based on this algorithm of updating the definitely safe coordinates based on the coordinates it stepped on, the possible pit coordinates, and the possible wumpus coordinates, the agent is able to figure out how to get to the gold.


-Once the agent reaches the gold, the agent simply follows the path it took as it has been keeping track of the coordinates it stepped on.


This is the map that this algorithm works:

Robot only knows these as it runs into them:

  • breeze_coordinates = [(2,1),(2,3),(3,4),(4,1),(4,3)]

  • stench_coordinates = [(1,2),(1,4),(2,3)]

  • glitter_coordinates = [(2,2),(2,4)]

  • nothing_coordinates = [(1,1),(4,4)]

Actual items that help/harm -- the robot does not know these in the beginning:

  • gold_coordinate = (2,3)

  • pit_coordinates = [(3,1),(3,3),(4,4)]

  • wumpus_coordinate = (1,3)


Below is the Successful Output of this map:



Map Output