Logic

The logic of IA*d is as follows:

  • IA*d will follow a pattern of going up to the top, turn right then head down the next column until it finds gold

  • If there is a danger in its way it will return to the start of the column and go down the next column

  • If there is a stench, breeze, or glitter, it will mark the adjacent blocks as possible Wumpus, Pit, or Gold respectively, when there is no input of stench, breeze, or glitter, it will mark the adjacent squares as Not Wumpus, Not Pit, or Not Gold respectively

  • IA*d will not enter squares with any danger marks

  • IA*d will attempt to move in a snake like fashion until unable

  • Safe squares override danger squares

  • If inside square, set square to safe

  • If encountering smell or breeze, set to adjacent squares that are not marked as safe to Wumpus/Pit danger respectively

  • If a danger (Wumpus/Pit) is marked twice in the same square, define that square as Wumpus or Pit

  • If a square gives overlapping signals from two different adjacent squares (i.e smell + breeze), they override and set square to safe

  • If there are two overlapping signals for one square where both a Wumpus and a Pit could be, the Wumpus takes priority for that square

  • If Wumpus is defined, shoot Wumpus and redefine Wumpus square as safe and clear all smell warnings

  • If glitter is defined, IA*d will move to glitter square

  • After reaching the gold, IA*d will reverse each of the movements it has made until it has reached the start again.