Today we added shooting capabilities to our robot!
Now that we can guarantee the position of the Wumpus, we are able to shoot it!
The robot is given one arrow each round, so knowing the position of the Wumpus is important, as we cannot afford to miss!
The logic for this part is quite simple, and we were able to implement it with no issues!
Now that we can guarantee the position of the Wumpus, we can determine if we are next to it or not. If we are to the left of it, we shoot to the right, if we are above it, we shoot down, etc.
If the sense "KILLED-WUMPUS" is detected, we clear the Wumpus's position on the board so our robot knows it is safe to go over that tile after the Wumpus is killed.
Shooting based on guaranteed position of the Wumpus:
- Start at (0, 0)
- Move to (0, 1)
- Get STENCH
- Retreat
- Move to (1, 0)
- Get STENCH
- (1, 1) is adjacent to both STENCH tiles so (1, 1) MUST be the Wumpus
- Robot is to the left of (1, 1) so shoot_right
Commentaires