Method
Components of the Challenge
Tasks
There are 4 distinct tasks that the program must be able to do at any given moment.
- Square Identification
- Memory
- Movement
- Attack
Agents
There are 3 agents that will be on the game board. There is only one of each, except for the pits (for which there are any number). Square adjacent to squares containing agents will give signals to the robot– one signal per type of adjacent agent.
- Gold – glitter
- Wumpus – smell
- Pit(s) – breeze
Game Board
The game board is a 4×4 grid of squares. The robot occupies one square at a time. Up to one agent will occupy each square. The robot cannot leave the game board or co-occupy the square of a hostile agent.
Algorithm Prototype – Movement
- Beginning – The current orientation is retrieved.
- Movement- The robot rotates until it faces the desired orientation. The robot moves forward.
- Straightening – Use the light sensors to make sure the robot is perpendicular to the game board (ie, temporarily stop wheels when one light is sensed on one side but not the other).
- Reset – The straightened robot moves a predetermined distance forward until it’s at the center of the square. The orientation is stored in memory.
The Algorithm
The idea for our algorithm actually came from playing the 90s computer game: MineSweeper. Most have probably played MineSweeper, but if not, no worry. There is a large grid in which the player must use logic to determine where the mines are. Quite similar to this project!
When playing MineSweeper the player marks each square either with a question mark (if he/she is unsure whether there is a bomb), or a check mark (if he/she believes there is a bomb). We decided to apply this idea to our robot.
This is not a technical explanation of the programming, so I will keep it in extremely simple terms. Basically the robot has an image of the 4×4 board in his memory. Initially we thought he would simply need to know whether each agent is in a square or not in a square. However we decided to apply the question mark idea. In each square, for each agent, the robot stores whether it is present, not present, or might be present. To help you understand, let’s consider a few scenarios:
- If Ultron has not yet been adjacent to a square, all agents might be present.
- If Ultron senses a breezy signal, no smell, and no glitter, a few things happen. The robot stores in his memory that all of the adjacent squares might have a pit, and all of the adjacent squares do not have a wumpus, and do not have gold.
- If Ultron senses a breezy signal and only one of the adjacent squares might have a pit (because he already knows the other adjacent squares do not have a pit), he determines that it is a pit.
- Ultron can only move into a square once he determines there is not a pit or a wumpus.
- Once Ultron finds the gold and the wumpus, he immediately determines that all other squares do not contain the wumpus or the gold.