Comp Sci 2026 Computer Science 2026

Assignment: Choose Your Own Adventure

Due 12/30 at 11:59pm

A Choose Your Own Adventure (CYOA) story lets the reader make choices that change what happens next. In this project, you will write a program that runs a story of your own design. Pick any topic you like.

Your program must meet the following specifications:

Additional Challenges (optional)

Example Story

Here is a short example with 2 pages (yours must have at least 8):

story = {
    1: {
        "text": "You wake up and hear a knock at the door.",
        "options": [
            {"text": "Open the door", "page": 2},
            {"text": "Ignore it", "page": 2}
        ]
    },
    2: {
        "text": "The knocking stops. THE END",
        "options": [
            {"text": "Quit", "page": None}
        ]
    }
}

Example Code

def show_page(page):
    # TODO: print page["text"], then print each option with a number, e.g. "1) Open the door"
    pass

story = {
    # fill in your story here
}

current_page = 1

while current_page is not None:
    page = story[current_page]
    show_page(page)

    choice = input("\n>> ")

    # TODO: check if choice is a valid option number; if valid, set current_page to that
    #       option's "page", otherwise print a warning and show the same page again

Example Output

You wake up and hear a knock at the door.

    1) Open the door
    2) Ignore it

>> 3

Invalid choice "3"

You wake up and hear a knock at the door.

    1) Open the door
    2) Ignore it

>> 2

The knocking stops. THE END

    1) Quit

>> 1