Algorithm

Start

Update map

Indicate if gold is in states

All checks in separate for loops iterating through the point’s neighbors:

Check if have gold

Move to origin following streamlined move history

Check if path to an undiscovered space is defined

Move to next point in path

Check if adjacent spot is confirmed to have gold

Move to it

Check if adjacent spot is suspected to have gold and is safe to move to

Move to it

Check if can kill wumpus

Remove stench and any wumpus suspicion from the map

Kill wumpus

continue

Check if safe and unknown

Return Move to space

Search for an unknown, safe space in the map through recursion, and create a path to it

Move to the first point in the path

If all else fails, move up and pray you don't die



Algorithm Analysis

Step 1: The Robot is started. The Robot begins by creating its own map. Much like how a human would only know the info that could be seen, the robot makes its own map. This way it can make informed decisions on where to move


Step 2: The map is updated with all known details. This includes known pits and wumpus, breezes, stenches, glitters, etc.


Step 3: The Robot checks if it has gold. If it does, it will begin heading back to the start, otherwise it will continue to search for it. As it traces its steps back to the start it will optimize the path, seeing if it can return back to the start more efficiently.

Step 5: The algorithm prioritizes finding the gold, so if it determines that a space adjacent to glitter is safe to move to, it will always move there.

Step 6: If monke bot cannot find any gold to move to, it the prioritizes killing the Wumpus. If an adjacent space has been confirmed to have a Wumpus it will always go for the kill.

Step 7: If the bot can neither obtain the gold or kill the Wumpus, it will look for an adjacent space that is safe to move to, to continue to explore the map.


Step 8: If none of the adjacent spaces are guaranteed safe to move to, monke bot will search for a position on the map that is unknown and safe to move to, and plot a path, activating step 4.


Step 9: If all else fails, move up in a last ditch effort to find a safe space. (Ended monke bots career on map 3)