Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using python: In this tutorial we will be building an interactive story( like one of those choose your own adventure novels).The story will be built

Using python:
In this tutorial we will be building an interactive story( like one of those choose your own adventure novels).The story will be built out of a sequence of scenes stored in a somewhat tricky data structure.In part 1 youll learn about the structure of each individual scene. In part 2 you will be build a full story into one structure of data. In part 3 you will display a single scene to the screen. Solve part 3 only
image text in transcribed
Fido * 43% 11:06 AM people.scs.carleton.ca be the label for a scene. Each value in the story dictionary will be the detals for a scene (which we defined as a dictionary in Part 1). That is, story will be a story dictionary with a complete story of scenes. To do this you will need to create several scenes like the one you built in Part 1. For each scene you should add it to the story dictionary with a unique label Eg. storyl'Appzoach' dictionary from part 1> storyl'Entrance'-- A path through the story starts at the 'Approach' soene and follows each of the users choices to the next selected scene. For example, if the user chooses to Enter the Tomb of Horrors" (which is the first choice in choices), then the next scene will be the one labelled "Entrance (which is the first label in nextScene). Scenes that have no choices are end points in the story. You can wnite your own story, or if you're not feeling creative today, you can use the ext from this story, You will stil need to translate it into the scene structure in your code. With the story dictionary built its time to start belling your story. Lets start by displaying a single scene. Create a main) function to put your story telling code in. Start with a variable to hold the current scene's data. This will make the code we have to write simpler by not having to access the story dictionary every time sceneData -storyl'Approach' With that in place its time to display the data in the scene. Start by printing the scene text, so the user can read this step of the story Next, if the soene has any choices, display each of the choices to the user, and then prompt them to select one. Nobe, you wil need to provide simple labels (e.g. numbers) so that the user can easily select an option We will hande the users selection in Part 4. For now, ensure that you can display scenes that have choices as wel as scenes that dont Scenes without choices should simply have the scene text printed, with no user prompt given. 4-Telling a This part describes the mechanics of making the story telling process going from scene to scene according to the users choices The story teling process will be a loop that does the following 1. Display the current scene 2. Get the users choice 3. Set the current scene to the chosen next scene This loop should repeat until the story reaches a scene with no choices To start, create a variable at the top of your main) function called currentScene with the value "Approach" (or whatever your first scene is labelied). This variable will keep track of which scene in the story we're currently on

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

Step: 3

blur-text-image

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

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago