Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem C. (10 points) Text Adventure Game Using the function from the previous problem, write a function adventure() which takes in no arguments, and gives

image text in transcribed
image text in transcribed
image text in transcribed
Problem C. (10 points) Text Adventure Game Using the function from the previous problem, write a function adventure() which takes in no arguments, and gives the user a sequence of choices, leading to one of several endings. Stince we want this problem to not be impossible to grade, you need to follow a very specific choice structure, namely the one outlined in the flowchart below: Note that: - Each diamond represents a decision, for which you must call your choose_three function from problem B. - Each arrow represents one of the three possible choices for that decision: A, B, or C. - Each rounded box represents an ending to the story, which comes in one of two possible types: Good (the user sueceeds in some way) or Bad (the user fails). Cour function should return the boolean value (not the string) True if the user reachod a Giod ending, of False if they reachod a Bad ending. You can put in a few additional print statement, beyond the ones inside the choose_three function to better explain the story, but this is not required. The story itself is entirely up to you, with one exception: you can't use the one in the example below. We will not be grading you based on the story's quality, logic, originality, or grammatical correctness, so if you're lazy and just want to put in single letter strings for every single choice, that's fine, but you must follow the choice structure in the flowehart above. Hints: - When you call the choose_three function from within adventure, you need to save the result to a variable, or you won't be able to access the value that choose_three returns. - Even if you aren't writing a story, make sure to use different strings for each decision point - it'll make it much easier to debug problems if you can tell where you are in the flowehart by what choices are printed out. Constraints: - Any test cases, or other code in yoar hw04 py file that's outside of the function definitions, must be placed in the if _name _-." - main _ block, or you are likely to crash the Gradescope testing scripts. - You must use the choose_three() fanction from problem B for each decision. - There should be no calls to the inputo function anywhere in the code for adventure(): choose three already takes in user input, so if you need to take in more user input then. you're not wing choice correctly. Viumples (uest in bold is retumed, text is red is user input, text in italice is printed. Note that: becnuse you are required to have a different story than mine, the printed text ahould not mateh. Wus the same sequenes of inpats shevald lead to the mane reharn value): Examples (text in bold is returned, text in red is user input, text in italics is printed. Note that because you are required to have a different story than mine, the printed text should not match, but the same sequence of inputs should lead to the same return value): adventure() You sneak into the dragon's lair, with your comrades wizard McBlastyFace and Stella the Bard. The dragon is fast asleep. A. Tell your team to start stealing things B. Tickle the dragon on the nose C. Tell your team to prepare for battle Choose A,B, or C:B The dragon sneezes out a fireball and incinerates you instantly. False You sneak into the dragon's lair, with your comrades wizard McBlastyFace and Stella the Bard. The dragon is fast asleep. A. Tell your team to start stealing things B. Tickle the dragon on the nose C. Tell your team to prepare for battle Choose A,B, or C:A You can't carry the entire hoard of loot. A. Take as much gotd as I can carry B. Take the pile of silk in the corner c. Take the huge diaiond curled under the dragon's claw Choose A,B, or CtC

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions