Write a simple text adventure game

Assignment Help Computer Engineering
Reference no: EM131272995

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.

Reference no: EM131272995

Questions Cloud

Suggest three techniques to overcome the given challenges : One of your developers tells you that it would be way too complicated to add voice recognition into the app. Suggest three techniques to overcome the challenges of implementing natural language into interface designs.
Marketing plan-sales strategy : Write the three to five (3-5) page Marketing Plan & Sales Strategy section of your business plan, in which you:
Explain the pico elements : Conduct a library search and locate one scholarly article that addresses the topic you have selected.- Explain the PICO(T) elements, and provide a full reference of the article you selected.
Analyze the factors contributing to the development : Analyze the factors (both genetic and environmental) contributing to the development of a specific mental disorder (of your choice). Discuss steps that could be taken to reduce the incidence of the disorder that you had identified above. Be sure t..
Write a simple text adventure game : 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.
Imagine you represent a person : Imagine you represent a person who claims to have been the victim of a breach of contract. Determine the information that you would need to know to best determine if there was a contract.
Half of the variation in personality : Research on genetic influences on personality suggests that more than half of the variation in personality is due to nurture-to life experiences. What life experiences could make someone more conscientious? More agreeable? More neurotic? More extr..
Define and explain ethical theory : Explain how ethical thinking results in practical, moral action. Briefly illustrate how this is applied in your personal life. And Include three or more scholarly resources.
Create a class called month with the given fields and method : Create a class called Month (java file called Month.java) with the (exact) following fields and methods. Create three objects: Month1 one using the first constructor (with no arguments) and Month2.

Reviews

Write a Review

Computer Engineering Questions & Answers

  How to use a sorting algorithm

Prompt the user for name and age of a group of people. The group's size is unknown at first , so the program must keep asking the user if they want to enter more data.

  Make modelling to assist with analysis and decision making

Perform modelling to assist with analysis and decision making. Translate business requirements into systems by applying appropriate SDLC methodologies and incorporating industry best practices

  Why grades averaged and sorted from highest to lowest

The names need to be sorted alphabetically why grades averaged and sorted from highest to lowest.

  Mutual authentication and key establishment protocol

Assume a server-assisted mutual authentication and key establishment protocol. Suppose that Alice and the Server share the pairwise symmetric key KAS; however Bob and Server share a pairwise symmetric key KBS.

  Developing application dislaying button and label on screen

Develop an application which shows a button and a label on the screen. Each time the button is pushed, the label will show a random number between 1 and 100.

  Program computes and prints the 1000th prime number

Write down a program that computes and prints the 1000th prime number using code blocks c++

  Using the sentinel controlled while loop develop an

using the sentinel controlled while loop develop an algorithm using pseudocode for computing cosx and sin x for the

  Suppose that you are on the staff of a prc legislator

assume that you are on the staff of a prc legislator. outline the arguments that you would use to support a law that

  How a composite key and a composite attribute are different

At least one website reference. Must have in-text citation for all the references used. Analyze how a composite key and a composite attribute are different. Explain how each would be indicated in an ERD.

  The solution is about the kinds of ai systems

The solution is about the types of AI systems that could be used to help make systems more efficient. It also explains how they would help.

  Oriented programming paradigm is considered a better choice

express why the object oriented programming paradigm is considered a better choice than the structured programming paradigm. Does it reflect our "natural" way of thinking or do you find it artificial?

  Hhf employees to recognize and avoid malware treats

give screenshots and an explanation of your results when you download, install, and run a security program such as Spybot - S&D.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd