Ask Computer Engineering Expert

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. Once through a door the player cannot go back through the door that she came 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 0
N: Monster
S: Genie
E: Picture
W: Exit
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 with 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:

? monsterRoom: Returns nothing; takes two integers both by reference and a string by value.

The function reduces the values of the variables storing the number of bananas and oranges to 0. This function should also tell the player what monster attacked them.

? genieRoom: Returns nothing; takes two integers both by reference (number of bananas and oranges, respectively). Increase the values of the variables storing the number of bananas and oranges by the appropriate number as per the game specification. The function should also output the message telling the player what she encountered in the room and what happened.

? pictureRoom: Takes no parameters and returns nothing. This function must output the proper announcement and draw a picture to the screen. We have provided a drawPicture function for your pictureRoom function to call; the provided function actually does the picture drawing. Your function should also tell the player what happened.

The drawPicture function is HERE, you should copy and paste it prior to the pictureRoom function call then invoke it as part of the pictureRoom implementation

Implementation Hints

? You will need variables to store the number of bananas and oranges.
? Follow every input operation by outputting a blank line utilizing a separate output operation.
? Some of the functions will use reference variables for all or some of their parameters.
? DO NOT use global variables
? Before the adventure begins, ask the user for their name and the scariest monster they can think of, storing each as a string. You will pass the monster name to the associated function when the monster attacks the player.

Testing Specifications

As with all games we wish them to be as unpredictable as possible. However, when testing to verify the program is in working condition we must have a measure of predictability. To achieve similar results to the ones shown within the input and output samples you should utilize a random seed value of 500 (srand(500);). This is for testing purposes only! You should maintain the unpredictability on turn-in and submit with with srand(time(0)) as the seed call.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92027720
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As