Programming AI with Language · scripted
Walkthrough: Build “Fact or Fiction”
Walkthrough: build “Fact or Fiction”
This is an interactive exercise to guide students through on a shared screen. Talk through what you are adding as you go. We will walk students through building a game so they can see the relationship between the instructions they give and how AI responds.
Games are useful here because they have clear rules and a natural turn-by-turn sequence that mirrors a conversation with AI. At each turn, we state what should happen, the player provides an input, and AI responds. The goal is to help students start thinking about how to instruct or program AI through language.
The flow is simple. We begin by writing an initial prompt that defines the game—the first version of the rules we have designed. We play the game and notice places where we want to change how it works. We then describe the change as a new rule, show students how to add that rule to the starting prompt, and play the game again to see what changed.
Step 1 · Build the Game, Fact or Fiction
To get started, we need to build the starting prompt that defines the game. This game, Fact or Fiction, will work as follows:
- Ask the player for a topic.
- Present three surprising statements about that topic.
- Make exactly one statement true and two statements false.
- Wait for the player to guess which statement is true.
- Reveal the true statement and explain all three after the guess.
These are the rules we need to translate into language. Here is the initial design of the starting prompt—the first version of the program.
Prompt to start the conversation
Open an AI tool such as ChatGPT, Claude, or Gemini. Copy the starting prompt above and send it as the first message in a new conversation. Then play through one round with students: provide a topic, make a guess, and read the explanation together.
We are going to play a game called “Fact or Fiction.”
Here are the steps:
Ask me for a topic.
After I provide a topic:
- Present three surprising statements about it.
- Make exactly one statement true and two statements false.
- Number the statements 1, 2, and 3.
- Do not reveal which statement is true.
- Wait for my guess.
After I guess:
- Reveal the true statement.
- Explain all three statements.
If you understand these instructions, acknowledge by saying only: Ready to start the game.
Ready to start the game.
Octopuses
1. An octopus has three hearts.
2. An octopus has bones in each arm.
3. An octopus breathes only through its skin.
Which statement is true?
I guess 1.
Correct. Statement 1 is true.
- True. An octopus has three hearts: two pump blood through the gills, and one pumps it to the rest of the body.
- False. An octopus has no bones at all, which is why it can squeeze through any gap larger than its beak.
- False. An octopus breathes mainly through its gills. Its skin absorbs some oxygen, but not enough on its own.
At this point, the game works. It has a topic input, a guess input, a rule for each, and a result. There is no score and no second round yet.
Step 2 · Add a score
Now we will add a score. The program will remember the score, add a point for a correct guess, and show the updated score after each guess. Explain that new rule to students, add it to the starting prompt, start a new conversation, and play the game again together.
Revised starting prompt · Version 2
The game now has state. It must remember the score while the conversation continues.
Step 3 · Add more rounds
Next we will add more rounds. After each answer, the program will ask whether to continue. Explain that new behavior to students, add these rules to the starting prompt, start a new conversation, and play again together.
Revised starting prompt · Version 3
Now the program responds differently to different inputs: a topic starts a round, a guess answers a round, and yes or no determines what happens next.
Step 4 · Make the response predictable
Finally, we will add two things. First, we will tell the program how to handle different kinds of input, including an invalid guess. Then we will give it exact templates for displaying a round and a result. Explain these additions to students, add both parts to the starting prompt, start a new conversation, and play again together.
Revised starting prompt · Version 4
The template is part of the program. We have now specified the goal, the inputs, what happens for each input, the state to remember, and the format of the output.