Question
Code Hunt the Wumpus Game, The Wumpus lives in an underground cavern consisting of 20 smaller caves. Each cave has 3 tunnels leading from it
Code Hunt the Wumpus Game, The Wumpus lives in an underground cavern consisting of 20 smaller caves. Each cave has 3 tunnels leading from it to other caves. For the caves i have to read from this txt file(at the bottom of this page) and store it into an array or vector(preferably array). The numbers indicate which cave travels to which cave and the directions are used as inputs. The directions correspond to the number in each line respectively.
Besides the Wumpus, there are several other hazards that could be fatal. These include two caves with bottomless pits if you happen to go into them, you fall into the pit (and lose). Two other caves have super bats if you stumble in them, you are immediately carried away by the bats and left in a random cave (would be annoying to say the least). The Wumpus, on the other hand, is not bothered by these hazards (he has sucker feet and is too big for the bats to lift). It is usually asleep, only waking up if you blunder into its lair or if your shot goes astray (clattering weapons do echo quite loudly underground). If you do manage to wake a Wumpus there is a 75% chance that it will move to an adjoining cave or it may decide (25% chance) to go back to sleep where it is. If it moves to the same cave you are in you become lunch (and you lose). When entering the caverns, you have a map, a lantern that has a limited amount of oil which also sets the number of turns you have (starts with 100), and you are armed with a bow and 5 arrows. Each turn, you may move to an adjacent cave, using one of the 4 standard compass directions [N, S, E, W] (which also reduces your lantern oil) or shoot an arrow into a cave [shoot] (hopefully hitting the Wumpus and killing it). Your lantern oil will be reduced by a random value between 2 and 4 when you move or shoot. Also, we can look at the location of the Wumpus, pits and super bats by little bit cheating.
When you enter a new cave, if you are one cave away from the Wumpus or a hazard, you will be given a clue indicating what is in one (or potentially more) of the caves leading from your current location but not the direction in which it lies. Bottomless Pits: they tend to be drifty, very deep and easy to fall into! They will just kill you outright, should you fall into one. So, watch your step! Super Bats: a colony of these bats makes an awful racket and are very protective of their domain. If you happen to wander into their cave, theyll swam you and carry you off to some random cave within the caverns. Wumpus: a nasty beast that smells really dreadful and sleeps a lot. If its awake and youre in the same cave then youre its lunch a truly horrible way to die. The Wumpus is not bothered by pits or bats so is free to roam anywhere in the caverns.
End game conditions You win if you successfully shoot the Wumpus. You lose if your lantern runs out of oil, or you run out of arrows, or you fall into a pit, or you end up in the same cave as the Wumpus. You should try to avoid these things!
You MUST implement your program using the following classes, as a minimum, you may include more (as appropriate for your game design):
Player class: holds the players details including their name and the equipment they are carrying (arrows, lantern [turns], map, etc.).
Location class: holds details of the various locations in game including a description, exits, and whether it has a hazard or not (you can call it whatever is appropriate for your game Cavern, Cave, Room, etc.)
Application file: holds the main() function and controls the overall flow of the game. You may include other relevant attributes and behaviours to these classes, as identified in your project plan.
The Player must be able to do the following:
assign a name which is requested at the start of the game and used in the feedback given
assign the players initial attributes to the required values (as stated in the brief)
update and display the players statistics (stats) during the game
explore the game locations using the compass directions: N, S, E, W
shoot arrows at the Wumpus: shoot
look at the locations of Wumpus, pits and super bats at any time: cheat
quit the game at any time (during or after a game): QUIT
The Locations must be able to do the following:
be loaded from a text file and stored appropriately at the start of the game
assign a name and initialise attributes (as stated in the brief)
access and display data about a hazard if it is in the location
display all appropriate information when the player enters it (name or number, description, exits, other information if required)
The Game Application must do the following:
display the how to play information at the start of the game
initialise both the player and the hazards with appropriate attributes/behaviours
display an appropriate and uncluttered user interface providing relevant information to the player at all times
allow the player to explore the locations of the caverns using compass directions
display the information about each location as it is entered (name, direction of exits, etc.)
terminate the game (player wins) when the player has killed the Wumpus
terminate the game (player loses) when the player has run out of oil in their lantern (turns) or arrows, or is eaten by the Wumpus
provide player stats at the end of the game (success or failure, inventory, etc.)
the player should be able to QUIT the game at any time
I would really appreciate if anyone could help me with this thank you so much!
[0] Well, this is it! This is your big chance to make a lot of~ money in a very short space of time (the faster you do this~ the more you will earn) OR die in an equally short period.~ The choice is yours ...~~ The long climb through the mountains has left you a little~ bit shaky, but that could also be just an increase in your~ adreneline. The sounds of the cheering crowds have long~ since faded into the distance.~~ Your quiver of arrows is securely slung over your back, some~ food in your pouch and a full lantern, which is now burning~ burning brightly in your hand. OK, the lantern isn't going to~ last all day so you'd better have at it, hmmm?~~ Enter the cave to see what you have let yourself in for ... 1 0 0 S [1] This is just one big empty space! And it doesn't even smell~ too bad!! 8 2 5 SEW [2] This rather odd-shaped cave is cold and drafty. The ground is~ very muddy and slippery (so be careful where you walk). There~ is a large pool of swirling water here along the northern wall. 1 3 10 NSW [3] This largish cave smells dank and mouldy. An assortment of~ moulds grows quite happily on the eastern wall. There are~ many murky puddles on the floor. 12 2 4 NEW [4] This cave smells mostly of rotting vegetation. An assortment~ of fungi grows quite happily on the eastern wall. 14 3 5 NEW [5] This cave is quite small and cramped. A thick slime coats some~ of the surrounding walls. 1 4 6 NSE [6] This naturally-formed cave is small with a low ceiling. Water~ drips down the eastern wall (from some unknown source) making~ the wall to become slick with an odious slime (ugh!!). 7 15 5 NSW [7] A maze of twisty passages ... all different. 8 17 6 NEW [8] This roundish cavern is strewn with rubble. It's quite~ dry in here and the floor quite dusty. Scattered amongst the~ rubble are various broken implements, bones & sticks. 1 9 7 NEW [9] Along the southern wall of this large cavern are many huge~ stalagmites and stalactites like teeth in the gaping maw of~ a dragon! 8 10 18 NEW [10] Whoa! This cavern is humongous! Signs of reasonably recent~ habitation abound here. You know, the usual ... broken bones,~ dead fires, dried blood, bits of fur, and so on! 9 11 2 NSE [11] This is more like a cavity than a cave providing little relief~ from the close walls. 10 12 19 NSW [12] The ground is damp in places and the air is quite stale within~ this section of the narrow passage. 11 3 13 NEW [13] A maze of twisty passages ... all alike. 20 12 14 NEW [14] This cavern is quite large and almost rectanglar in shape.~ The ceiling disappears into the gloom far above your head. 15 13 4 NEW [15] This cavern smells rank and mouldy. A haven for magic mushrooms~ as an assortment of fungi grows quite happily on the southern~ wall. Water constantly drips from the ceiling into murky puddles~ on the floor. 6 14 16 NSE [16] In the northern alcove of this small, ovoid chamber is a small~ mound of dirt surrounded by stones. It looks suspiciously like~ a burial mound. 17 20 15 NSW [17] In this small cave the walls are slick with slime from years~ of constantly oozing dampness. 7 16 18 NSE [18] You find yourself in another longish, cavern. Along the eastern~ wall are many stalagmites as well as stalactites - some many~ metres tall, others wide. 9 19 17 NSW [19] Yet another winding tunnel! You haven't been here before,~ have you? 18 20 11 NSE [20] Phew! This must be the Bog of Eternal Stench and the smell is~ enough to make your eyes water. Whoever, or more likely, whatever~ was here before you was definitely NOT potty-trained! 13 19 16 SEW
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started