Question
Main Lab 4 - Multipath Adventure Multipath Adventure Game For this lab, we want you to create a Multipath Adventure Game. Decision Tree Before beginning,
Main Lab 4 - Multipath Adventure
Multipath Adventure Game
For this lab, we want you to create a Multipath Adventure Game.
Decision Tree
Before beginning, create a decision tree for your game. This is worth 10 points on the lab. You need to turn this in on Canvas, and it is due before the Main Lab itself is due. See the previous section in zyBooks for more details on the decision tree.
If you need to, you can adjust the decision tree as you are programming. Resubmit the final decision tree with the lab submission quiz.
Note that you are allowed to use concepts we have not covered in class if you would like to (e.g. loops, etc.). This might also help you to prepare for future labs.
Your program will need to contain at least 5 decisions/branches with at least 3 end states.
- Note that a branch point is where a decision is made, not where you go after making a decision. Your program should have 5 branch points (i.e. "forks in the road") where different outcomes may occur depending on the direction chosen at each branch point.
- This needs to be 5 branch points in the whole program, not necessarily 5 per path - it is possible that an individual path a user might take will have less than 5 decisions before terminating.
As part of grading your lab, the TAs will randomly pick 2 paths through your decision tree to check your work. They will reference your submitted decision tree to choose the paths and make sure that when they run your code it takes them through the path as specified in your decision tree.
To make your game easier to play (and thus make it easier for the TAs to grade) you should provide prompts before each input that make clear what inputs are valid.
It is important that your Decision tree is clear and easy to read. This decision tree will serve as the "rubric" to how your code should run and, thus, be graded. You will notice that the only autograded points for this lab are that your code compiles and meets the bracing requirements found in the style guide. If your code does not follow the Decision tree that you have created, then points will be deducted according to the listed requirements below. Again, your tree must be clear and easy to read so that you don't lose points!
Functions
Your program must utilize at least 3 functions
- At least one function (other than main) needs to have at least 2 parameters
- Your parameters must be values that are passed in from outside of your function. A parameter that passes a value that will be changed on the first line (e.g. using cin to give it a new value) is not a good use of a parameter. In this case, it would be better practice to declare a local variable for that value within the function instead of passing in the dummy variable as a parameter.
- At least one function (other than main) needs to return a value
Your functions must actually be used within your code. It is great practice to write a function body, but it's even better for you to actually use the functions that you have written. Therefore, if your functions are not used or serve no purpose (i.e. they do nothing), then you will lose points.
Suggestions for useful functions:
- A function to handle printing a prompt and reading user input, returning the value of the user's input. Such a function could be easily extended to be even more useful in the next lab. This function would need a string parameter (containing the prompt), and possibly another parameter indicating how many options are available (i.e. 3, could indicate that 1, 2, and 3 are valid choices, think about what you could do with this information)
- You could implement the various choices or "paths" of your game as functions (i.e. if the user chooses option 'a' which lead them to a dungeon, then GoToDungeon() is called, etc.)
Terminating the Program
An end state is defined as the final point in your program after your code has finished running. In this state, you are able to observe variables and output given to the user. You must have three unique circumstances for each of your end states. Another important part of an end state is that the program has terminated, meaning it is not expecting to receive input or to run any more code. If your program is still expecting input at your end states, then your code hasn't actually reached an end state! If your code does this, you will lose points for not having a proper end state.
Special Requirements Graded by TAs
- You must adhere to the style guidelines. (up to 10 points)
- You must have at least 5 decision points in your code (5 points per missing decision point)
- You must have at least 3 possible end states for your game (5 points per missing end state)
- Your code must correctly follow the paths outlined in your decision tree (15 points per path that does not work correctly)
- This includes terminating properly at the end of a path - if you need to end the program early at any point in your code, you can use the command exit(0); to end your program at any point
- You must use at least 3 functions in your code (5 points per missing function)
- Your functions must be used within your code
- You must use at least 1 function (other than main) that has at least 2 parameters (15 points)
- The function must actually make use of the parameters and adhere to the requirement above in the "Functions" section regarding the parameters of your function.
- You must use at least 1 function (other than main) that returns a value (15 points)
- The return value of the function must actually be used by the caller of the function
A Note on Enumerated Variables
It is typically not good practice to have enumerated variable names (e.g. "choice1", "choice2", etc.) because you may ultimately add a choice between 1 and 2 that now forces you to change the names of several of your variables. There are several ways to fix this, one of which is to have a single input variable. Whichever you choose, make sure that you don't enumerate variable or function names in this way. If you do, you will lose points.
You have a biology exam tomorrow. Do you a) study hard for the exam, or b) decide to go to the salt flats with your friends? -a You think twice about your decision. Do you a) go on the fun adventure, or b) stay back with another friend who has to study You are super tired and start thinking of alternatives to studying. Do you a) push through and keep studying until the exam, or b) decide to go hike Timpanogas? Woohoo! You had so much fun, but also got a D on the exam. Your friend wants to take a break from studying. Do you a) go to the mall with him, or b) convince him to stay. You find a tribe in the mountains and decide to live with them for the rest of your days. b On the way to the mall, you and your friend are kidnapped and taken away to another country, never to be seen again. After studying for six hours, it is almost midnight Do you a) stay up all night studying or b) go to bed and wake up an hour early to quickly go over what you learned the night before Very good choice! Congrats on the A on the exam! You were so tired from studying so much the night before that you fell asleep right at the start of the test. You woke up right as time finished. Earning you 0 points on the examStep 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