Problem H
Hunt the Wumpus
Hunt the Wumpus is a game you play against the computer on a
You have been asked to write the computer portion of the
game. User guesses and randomly-generated wumpus locations are
defined by a two-digit number, where the high digit is
To make the game deterministic, we will use our own
pseudo-random-number generator, with a supplied seed
Input
The first line contains a single integer
The input will always be well-formed, and will describe a complete game. The last user guess will always find the last wumpus. There will be at most 250 guesses in any input.
Output
Output the computer’s response for each player guess. If a
guess hits a wumpus, you should output “You hit
a wumpus!” on a line. Whether or not the player hit a
wumpus, if any wumpuses remain uncaptured, output the Manhattan
distance to the closest remaining wumpus. The Manhattan
distance between two points
At the end of the game, report the total number of moves
Sample Input 1 | Sample Output 1 |
---|---|
203811 00 01 02 03 |
You hit a wumpus! 1 You hit a wumpus! 1 You hit a wumpus! 1 You hit a wumpus! Your score is 4 moves. |
Sample Input 2 | Sample Output 2 |
---|---|
101628 00 40 60 68 78 95 |
4 You hit a wumpus! 2 You hit a wumpus! 8 1 You hit a wumpus! 5 You hit a wumpus! Your score is 6 moves. |