Text Adventure Game Design

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Text Adventure Game Design

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which function is used to display story text to the player in a text adventure?
A print()
B input()
2. Which function captures the player's choice in a text adventure?
A input()
B print()
3. Which keyword structure sends the player down different story paths?
A while/for
B if/elif/else
4. What is the purpose of while True: in a text adventure game?
A To keep the game running in a continuous loop
B To check if the player's choice is true
5. Should you plan your game's rooms and paths before writing any code?
A No — just start coding and figure it out as you go
B Yes — plan on paper first using a map or flowchart

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1print("You are in a cave.") Aif choice == "left": print("Safe!") elif choice == "right": print("Danger!")
2choice = input("> ") BPauses the game and stores whatever the player types as a string
3if/elif/else creates branching story paths CDisplays the story location and description to the player
4while True: keeps the game running until the player quits Dwhile True: choice = input("> ")
5if choice = "run": EWrong — while must be all lowercase; While with a capital W is a syntax error
6While True: FWrong — use == for comparison, not = which is assignment

Definitions

text adventure

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
print("You are in a forest.") choice = _____("> ") if choice == "run":
2.
print("You are at a door.") if choice == "open": _____("You enter the room.")
3.
if choice == "left": print("Safe path!") ____ choice == "right":
4.
while ____: print("Game is running.") choice = input("> ")
5.
if choice == "north": print("A river!") ____: print("Invalid.")

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A print("You are in a cave.")
B choice = input("> ")
C print(choice == "run"):
Question 2
A # Game loop
B while True:
C choice = input("> ")
D whileEnd
Question 3
A print("You reach a bridge.")
B choice = input("> ")
C if choice = "cross":
Question 4
A if choice == "left":
B print("You go left.")
C elif:
D print("Other path.")
Question 5
A print("A dark corridor.")
B choice = Input("> ")
C if choice == "go":
D print("You walk forward.")

Answer Key

Text Adventure Game Design
Section A: Quick Questions
Q1
A — print()
Q2
A — input()
Q3
B — if/elif/else
Q4
A — To keep the game running in a continuous loop
Q5
B — Yes — plan on paper first using a map or flowchart
Section B: Match the Pairs
Q1
print("You are in a cave.") → Displays the story location and description to the player
Q2
choice = input("> ") → Pauses the game and stores whatever the player types as a string
Q3
if/elif/else creates branching story paths → if choice == "left": print("Safe!") elif choice == "right": print("Danger!")
Q4
while True: keeps the game running until the player quits → while True: choice = input("> ")
Q5
if choice = "run": → Wrong — use == for comparison, not = which is assignment
Q6
While True: → Wrong — while must be all lowercase; While with a capital W is a syntax error
Section C: Definitions
Q1
text adventure — A type of program where the player reads story text and types choices; built using print() for output, input() for choices, and if/elif/else for branching paths
Section D: Fill in the Blanks
Q1
print("You are in a forest.") choice = input("> ") if choice == "run":
Q2
print("You are at a door.") if choice == "open": print("You enter the room.")
Q3
if choice == "left": print("Safe path!") elif choice == "right":
Q4
while True: print("Game is running.") choice = input("> ")
Q5
if choice == "north": print("A river!") else: print("Invalid.")
Section E: Spot the Error
Q1
C — The branching logic needs an if statement, not print(). It should be: if choice == "run": with an indented block below. Line 2 is wrong.
Q2
D — Python while loops do not have a closing whileEnd keyword. The loop body is defined by indentation alone. Line 3 is wrong.
Q3
C — A single = is assignment, not comparison. The condition must use == to compare: if choice == "cross":. Line 2 is wrong.
Q4
C — elif must have a condition to test — elif: with no condition is invalid. It should be elif choice == "right": or similar. Line 2 is wrong.
Q5
B — input() must be all lowercase. Input() with a capital I is not recognised and will cause an error. Line 1 is wrong.