Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ program plz help! Write the program with function and loop! Assignment 2: Text Adventure Assignment Specifications For this assignment you will write a simple
C++ program plz help! Write the program with function and loop!
Assignment 2: Text Adventure Assignment Specifications For this assignment you will write a simple text adventure game. Within this game the player will travel from room to room choosing which door to traverse through. Game Specifications Every room in the game has 4 doors for the player to choose from, each associated with an uppercase direction: N, E, S or W. Three of the doors open up to another room, and the 4th door is an exit from the game. Of the three non-exit doors, one will send the player to a room containing a monster. Another will send the player to a room containing a genie. The third non-exit door will send the player to a room that has a picture. The player will begin the game holding two types of items, bananas and oranges. The player should start out with 5 bananas and 3 oranges For simplicity. There are two possible alignments of the 4 doors. At the beginning of each turn this random alignment is decided. For clarification on implementation we will refer to these alignments as 0 and 1 Alignment e N: Monster S: Genie E: Picture W: Exita Alignment 1 N: Exit S: Monster E: Genie W: Picture IMPORTANT: Only 1 random alignment is chosen per turn. If the user does not enter a valid directional door choice (N/E/S/W), keep asking for a direction but DO NOT get a new random alignment value. Door Actions The game should ask the player to choose a door to step into. If the player steps into a room witlh the monster inside, the monster will steal all of the bananas and oranges the player is holding. If the player steps into the room with the genie inside, the genie will give the player 2 additional bananas and 1 additional orange. If the player steps into the room with the picture inside, the game should just draw the picture to the screen but no other reward is granted. Finally, if the player steps through the door to the exit, the game should end. When the game ends, give the player her combined and individual scores. The combined score is the total number of bananas and oranges the player is holding when finding the exit. Functions You must write a function for each door. When the player chooses a door in a certain direction (N/E/S/W) - and only one of those values the program should call the function for the door in that direction or end the program if she chooses the door to the exit. Some of these functions will use reference variables for all or some of their parameters. You MUST use these function names and use the specified number and types of parameters for each function. Here is what each function must do: Assignment 2: Text Adventure Assignment Specifications For this assignment you will write a simple text adventure game. Within this game the player will travel from room to room choosing which door to traverse through. Game Specifications Every room in the game has 4 doors for the player to choose from, each associated with an uppercase direction: N, E, S or W. Three of the doors open up to another room, and the 4th door is an exit from the game. Of the three non-exit doors, one will send the player to a room containing a monster. Another will send the player to a room containing a genie. The third non-exit door will send the player to a room that has a picture. The player will begin the game holding two types of items, bananas and oranges. The player should start out with 5 bananas and 3 oranges For simplicity. There are two possible alignments of the 4 doors. At the beginning of each turn this random alignment is decided. For clarification on implementation we will refer to these alignments as 0 and 1 Alignment e N: Monster S: Genie E: Picture W: Exita Alignment 1 N: Exit S: Monster E: Genie W: Picture IMPORTANT: Only 1 random alignment is chosen per turn. If the user does not enter a valid directional door choice (N/E/S/W), keep asking for a direction but DO NOT get a new random alignment value. Door Actions The game should ask the player to choose a door to step into. If the player steps into a room witlh the monster inside, the monster will steal all of the bananas and oranges the player is holding. If the player steps into the room with the genie inside, the genie will give the player 2 additional bananas and 1 additional orange. If the player steps into the room with the picture inside, the game should just draw the picture to the screen but no other reward is granted. Finally, if the player steps through the door to the exit, the game should end. When the game ends, give the player her combined and individual scores. The combined score is the total number of bananas and oranges the player is holding when finding the exit. Functions You must write a function for each door. When the player chooses a door in a certain direction (N/E/S/W) - and only one of those values the program should call the function for the door in that direction or end the program if she chooses the door to the exit. Some of these functions will use reference variables for all or some of their parameters. You MUST use these function names and use the specified number and types of parameters for each function. Here is what each function must doStep 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