From Lore to Code: Turning Stories into Programs
By Dr. Malik Stalbert – ADD P2P Edition
The Power of Story in Learning
Most people imagine computer science as memorizing code or solving abstract puzzles. But in reality, coding is much closer to storytelling. A good program is like a story — it has a world, characters, rules, challenges, and outcomes.
That’s why in Attention-Driven Design (ADD) and the Pathways to Pipelines (P2P) framework, we begin with stories, not syntax. Stories are the most ancient technology for capturing attention, and attention is the foundation for learning anything new.
“Learning doesn’t begin with rules — it begins with a reason. In ADD P2P, that reason is always wrapped in a story.”
Worlds and Realms as Coding Environments
In this workbook, your first step is not writing code — it’s choosing a world. Maybe you pick Naruto, DC Comics, Harry Potter, Lord of the Rings, or even a music universe. By naming your realm and placing it on the Round Table Map, you’re defining the environment your creations will exist in.
The map is like a program environment.
The regions and provinces are like modules or namespaces.
The boundaries and shared events are like interfaces between systems.
Before a single line of code is written, you’ve already set the stage for how your system (or story) will run.
Characters as Objects
Once you know the world, you populate it with characters. Each character sheet has:
Traits and Stats → variables and attributes.
Dialogue → strings of text.
Abilities → functions or methods.
Weaknesses → system constraints.
When your group gathers at the Round Table, you’re essentially building an object-oriented program: a system of interacting characters (objects), each with their own properties and actions.
Potions, Technology, and the Logic of Balance
The Fundamentals Chart and Potion/Tech Recipe Calculator let you allocate points into elements like Fire, Water, Knowledge, or Alchemy. This isn’t just fun worldbuilding — it’s a hidden lesson in resource allocation and trade-offs.
If you max out Fire, your invention might be powerful but unstable.
If you balance evenly, your creation is stable but less specialized.
This is the same thinking programmers use when balancing speed vs. memory vs. complexity. Coding is always about making smart trade-offs, and you’re already practicing that here.
Machines and Devices as Classes
The steampunk devices you’ll sketch — with dials, chambers, crystals, and exhaust pipes — are another metaphor for programming. Each one represents a Class in code.
Inputs/Chambers → parameters.
Dials/Gauges → variables that change.
Pipes/Processes → functions.
Output glow/steam → return values.
What looks like an RPG invention is really an encapsulated system — exactly how classes and objects work in programming.
The Scrolls of Productivity
Even the Windows shortcut spell scrolls connect to this same philosophy. They teach learners to see everyday computing as incantations and rituals, preparing them to understand automation, scripting, and eventually coding. Shortcuts become “basic spells,” and scripts become “advanced runes.”
This makes computing less intimidating and more playful, while also reinforcing that every command has a pattern and effect — the heart of programming.
The Big Reveal
Later in the semester, you’ll revisit all these sheets — the map, the characters, the potions, the machines, the scrolls. And here’s the reveal:
You’ve been coding all along.
Your map is your environment.
Your characters are objects.
Your stats are variables.
Your dialogue is strings.
Your quests are functions.
Your devices are classes.
Your potion recipes are algorithms.
You didn’t start by memorizing syntax. You started by living in the story of coding. By the time you type your first real program, the ideas will already feel natural — because you’ve been practicing them through imagination.
The Takeaway
This workbook is more than a set of activities. It’s a spellbook of learning, designed to guide you step by step from imagination to implementation.
Every story you tell, every map you draw, every device you create is secretly a lesson in computer science — just hidden under the fun of fantasy.
By the end, you won’t just know how to code. You’ll understand how to design, balance, and build worlds of logic and creativity.
From Lore to Code, from story to syntax.
Thought Project: The Steamforge Device
The Story
Imagine a strange contraption called the Steamforge Device.
At the top, a glowing crystal provides the energy.
The crystal’s energy is funneled through a series of gears and gauges that determine the pressure and flow.
In the middle, a glass chamber mixes ingredients placed inside.
Finally, the machine releases an output: a potion, a spark of energy, or even a strange new alloy.
The user must set the dials correctly, provide the right inputs, and watch the outcome.
If the settings are wrong, the chamber overheats and smoke escapes.
How to Think About It
This machine is just like a function in code:
Inputs (parameters): The crystal energy level, the ingredients in the chamber, the dial settings.
Process (function body): The gears turn, the chamber mixes, the machine transforms inputs.
Output (return value): The final potion, energy spark, or an error (smoke).
using System;
class Program
{
static void Main(string[] args)
{
// Example Runs
Console.WriteLine(SteamforgeDevice(5, "herbs", 8));
// Output: Healing Potion (Overcharged — unstable!)
Console.WriteLine(SteamforgeDevice(2, "metal", 5));
// Output: ⚠️ Not enough energy. The device sputters and dies.
Console.WriteLine(SteamforgeDevice(7, "water", 2));
// Output: Strange Goo (Weak potency)
}
static string SteamforgeDevice(int crystalEnergy, string ingredient, int dialSetting)
{
// Step 1: Check if the machine has enough power
if (crystalEnergy < 3)
{
return "⚠️ Not enough energy. The device sputters and dies.";
}
// Step 2: Process ingredients with the dial setting
string result;
switch (ingredient.ToLower())
{
case "herbs":
result = "Healing Potion";
break;
case "metal":
result = "Forged Alloy";
break;
default:
result = "Strange Goo";
break;
}
// Step 3: Modify output by dial setting
if (dialSetting > 7)
{
return $"{result} (Overcharged — unstable!)";
}
else if (dialSetting < 3)
{
return $"{result} (Weak potency)";
}
else
{
return $"{result} (Balanced output)";
}
}
}
Teaching Points
The crystal energy is like a variable controlling flow.
The ingredient is like data input that changes the function’s outcome.
The dial setting is a modifier variable that changes the final result.
The return value is the potion, alloy, or error message.
This activity shows learners that every function is a little machine:
Put in inputs → follow rules → get outputs.


