← All games

Create and discover

The mysterious message

A library mystery. Clues to collect. Four endings. Your decisions change the story.

What does this have to do with programming?

Each choice works as a condition: choose one action and the game shows one continuation; choose another and it shows a different one. This is called branching. Returning to the riddle lets you repeat the same sequence of actions: the diagram’s loop helps explain programming loops.

if choice = A → show continuation A
else → show continuation B

The program remembers your clues and whether you solved the riddle. These variables change later texts and the ending. Inventory is your list of items; state includes your current location, inventory, riddle result and previous decisions. Going back restores the earlier state. Different routes can merge, but their outcomes depend on previous decisions.

Pseudocode for choosing the ending:

if NOT riddle_solved:
    ending = “The mystery still awaits”
else if action = “together”:
    if has(waves) AND has(clock_hand):
        ending = “Story Atlas”
    else:
        ending = “A continuation found together”
else:
    ending = “The secret author”

AND means both conditions must be met. The wave sign alone is not enough: the atlas also requires the clock hand, the solved riddle and the decision to create together.

Creative activity: create your own story

Time: 15–20 min. Work with a partner. Paper and a pencil are enough.

  1. Invent a character and one unexpected event.
  2. Write a beginning and two possible actions: A and B.
  3. Write a continuation with two more choices for each action.
  4. Create four endings. Give the choices clear consequences.
  5. Swap stories. The reader chooses a route and the author supplies the matching continuation.

Check: does every choice have a continuation? Is any route missing an ending? Does the choice make clear what the character will do?

Extra challenge: link one ending to an earlier decision. Discuss what information the program would need to remember.