the language is c++ and need to run it in code blocks The hero starts in the low
ID: 3741631 • Letter: T
Question
the language is c++ and need to run it in code blocks
The hero starts in the lower left-hand corner of the maze. He can move up, down, left or right on each turn providing he does not move off the grid. There are pits in the maze that the hero should try to avoid. If the hero moves into a location with a pit, he falls to his death and the game is over. If the hero moves into the square with the Wumpus, the Wumpus will eat him (a very unpleasant way to go which also ends the game)! In each location in the maze the hero can detect what may be around him through his senses. In squares next to pits the hero will feel a breeze. In squares next to the Wumpus the hero will smell a stench (due to the fact that the Wumpus has not bathed in three centuries)! The hero has one and only one arrow he can fire to try and kill the Wumpus. If the hero fires his arrow into the square with the Wumpus he slays the Wumpus and wins the game. If he fires his arrow into the wrong square, well, let's just say that the Wumpus enjoys snacking on defenseless humans!
Requirements:
You should simulate the maze with a two dimensional array of characters (which is 6 across and 4 down). The above maze is just an example of what the Wumpus World could look like. Have the program randomly determine where to put the Wumpus and the four pits. However, make sure you do not put the wumpus and pits in the same location as where the player starts. As players play the game give them the following options: u,d,l,r,s (for move up, move down, move left, move right, and shoot arrow). If players attempt to move off the grid tell them they bump into a wall. If players move to a square next to a pit tell them they feel a breeze. If players move into a square next to the Wumpus tell them they smell something so bad it makes their stomach churn! If players choose to shoot their arrow then prompt for a direction: (u,d,l,r). If the Wumpus is the direction the arrow is shot then the player wins. Otherwise, the player loses. Players also lose if they move into a square with a pit or the Wumpus.
At the end of the game, you should display the maze to the screen. You can display it in any way you like, as long as it is clear. Something like this would be fine:
(where ‘0’ indicates an empty square, ‘p’ a pit, and ‘w’ the wumpus)
Happy Hunting!
additional code (compulsory)
Modify the program so that if the arrow is shot it can be found again by looking around in the maze. Thus, the program would not end if the arrow is shot and it misses the wumpus. Instead, the arrow is placed in a random location in the maze (not already occupied by the wumpus and the pits).
Description: For this project you are to create the game Hunt the Wumpus. This is a simple game where the hero attempts to hunt down a monster called the Wumpus and shoot him with his arrow. The Wumpus World could look like the maze shown below breeze breeze breeze- breeze , breeze breeze-breeze- breeze breezer stench breeze - Start stench stench The hero starts in the lower left-hand corner of the maze. He can move up, down, left or right on each turn providing he does not move off the grid. There are pits in the maze that the hero should try to avoid. If the hero moves into a location with a pit, he falls to his death and the game is over. If the hero moves into the square with the Wumpus, the Wumpus will eat him (a very unpleasant way to go which also ends the game)! In each location in the maze the hero can detect what may be around him through his senses. In squares next to pits the hero will feel a breeze. In squares next to the Wumpus the hero will smell a stench (due to the fact that the Wumpus has not bathed in three centuries)! The hero has one and only one arrow he can fire to try and kill the Wumpus. If the hero ires his arrow into the square with the Wumpus he slays the Wumpus and wins the game. If he fires his arrow into the wrong square, well, let's just say that theExplanation / Answer
ANS:-
Given that,
You should simulate the maze with a two dimensional array of characters (which is 6 across and 4 down). The above maze is just an example of what the Wumpus World could look like. Have the program randomly determine where to put the Wumpus and the four pits.
If you haven't dealt with random numbers before I would advise starting with just picking a spot for each pit and the wumpus. I would make the first step to be just declaring your array and printing it. On the next iteration add in the comands take input and then process it and move a value (probably use 1 for the player) around the array with the bounds checking and messages when moving out of bounds. On the next iteration add in some logic to check the surrounding values to determine whether there is a breeze or a stench and to print it out. Lastly implement the logic for shooting an error (should be a relatively easy check) Then lastly add the random generation of the data. If you want to finish it up even more add a menu at the beginning to choose a difficulty level where there is a different number of pits for each difficulty and maybe a counter to count how many moves it takes and keep a scoreboard (this would just be optional to practice a little with file I/O) If you have problems with any specific steps in this process I'd be more than happy to help but I don't want to give away code upfront otherwise it will destroy the purpose of doing this project.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.