top of page
IMG_20181126_090941_edited.jpg

ALGORITHM

The first thing our algorithm does at the start of every initialization is creates an empty grid to represent each space on the physical board that the problem is on. Next, while the gold is not picked up by the robot, the robot takes in the input signal and determines what the signal translate to, whether it is nothing, breeze, stench, breeze and stench, glimmer, glimmer and breeze, glimmer and stench, breeze and glimmer and stench, or that the robot has gotten the gold. The robot would then move up the first time it moves, and reassign it’s position variable to correlate with its new position. When it moves the robot records every move it makes so that it can return home using its previous moves. After moving up the first time the robot would use its knowledge based on the signals it receives to determine which direction to go if it can't go up. Before moving the robot also orientates itself so as to make sure it will go in the right direction. The robot then checks which direction, with the newly inputted information and the information already on the grid, it can go for the next turn that would not put it in danger of either falling into a pit or being attacked by the wumpus. It assigns the direction it finds, or if multiple directions it will prioritize up then right, and then assigns the other directions as the signal it found before so that they are placed on the grid as possibilities. During this check for which direction is safe the algorithm also checks if the signal inputted was that the robot got the gold, and if it was then it reassigns the value for if gold is got to true. This then will break the loop of the robot looking for the gold on the board and the robot will start returning to the start. After the check is complete, and the robot moves, the algorithm checks if any of the grids on the board match the conditions for being the wumpus, being a hole, or being the gold and assigns them as such. As soon as the gold is assigned the robot is told to go towards it while making sure the spaces it travels on are safe. If there is no safe option the robot will continue transversing the board looking for a safe option. Finally the while loop rests after a new direction for the robot to go in is found, whether that will be to go towards the gold, or just scouting the board for signals. Finally, as said before, after the while loop stops the roboto will proceed to return to the start by using all of its previous steps that have been recorded in a variable. If any of these adjacent steps correspond, such as going up then down right after, the robot will ignore this step because it is pointless and will take it longer to do the same thing. The robot will eventually get back to the starting square, while avoiding all of the obstacles, and will turn itself around so that it will face the top of the board.

Get in Touch
Description of the Algorithm: About
bottom of page