Lesson 15. Capstone project: choose your own adventure

After reading lesson 15, you’ll be able to

  • Write code for a choose-your-own-adventure program
  • Use branches to set up paths through the program

This capstone project is somewhat open-ended.

The problem

You’ll use conditionals and branching to create a story. At each scene, the user will enter a word. The word will tell the program which path to continue following. Your program should handle all possible paths that the user might choose, but doesn’t need to handle any unexpected input from the user.

The walk-through you’ll see is one of many possible others; be as creative as you want with your storyline!

15.1. Outlining the game rules

Anytime you’re getting input from ...

Get Get Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.