Adapted from EYES, Ed Club 2017
CS20-CP2: Use common coding techniques to enhance code elegance and troubleshoot errors throughout Computer Science 20.
CS20-FP2: Investigate how control structures affect program flow.
Although nowadays most video games are made with extremely sophisticated graphics and online servers, some of the original computer games were as simple as choose your own adventure games.
You should use a flowchart to plan your story: CYOA Flowchart
You may also need to review user inputs from Chapter 8.
So how do we use input messages to make a Choose Your Own Adventure Story? By using if-elif-else statements:
If you want to add to your adventure, you can add a new branch with nested if-elif-else statements:
We can also use functions for repeating code:
Create your own choose your own adventure game. First organize your storylines with a flowchart then code your adventure in Trinket.
What is a Choose Your Own Adventure?