A Pixel Game to Teach Kids to Code. Here Is What Is Inside.
It's a Tuesday night, I've got three tabs open comparing BFS implementations, and at some point I catch myself arguing with myself about tile-ring numbering like I'm defending a thesis instead of building a game for 14 year olds. That's usually the tell that a side project has taken over.
The project is The Secret Stacks: a browser game where you pick a pixel hero, walk into a library, and collect books. On paper that's a weekend of work. It took me most of a season, because somewhere around week two I decided it shouldn't just teach kids to code, it should be built out of the actual things I wanted them to learn. A real SQL database. A real pathfinding algorithm. Files plain enough that a kid can open one, read it top to bottom, and understand what happened without a build step standing in the way.
The name is a small joke with itself. The deepest secret in the game isn't a plot twist, it's a single row sitting quietly in the database, waiting for whichever kid can't leave a WHERE clause alone. I'll get to that one. It's my favorite thing I built all year.
The library is the curriculum
Here's the part I'm proudest of: in The Secret Stacks, the database controls the world.
Every book lives in a real SQLite table, running in the browser through sql.js, columns for title, author, genre, year, a position on the map. Next to the game sits a SQL editor. Whatever rows a query returns become the books standing on the floor. Not a simulation of a database, an actual one.
Type `WHERE genre = 'funny'`, hit run, and the serious books disappear off the shelf mid-game. Sort by year and the whole catalog reshuffles itself while you watch. Type something wrong and the real SQLite error message shows up, unedited, the same one I get in my terminal when I mess up a query at 11pm. Kids aren't reading a diagram of what a database is. They're rearranging a world with SELECT statements, and getting told exactly why, in plain language, when it doesn't work.
Watching an algorithm think
Click a book and the hero doesn't just walk over. The game runs Breadth-First Search and then, instead of hiding the math, it narrates it. Blue tiles spread out from the hero in rings, each one stamped with a distance number, and the message box counts along. Ring 3. Ring 4. Ring 5. When the ripple reaches the book, the path lights up green and the hero walks it.
There's a speed control, turtle to lightning, because the best moment in a classroom isn't watching the hero arrive, it's slowing the ripple down until someone asks why the computer checked fifty tiles to find a ten-step path. I've watched that question land on a kid's face in real time. Give it a minute and they've basically reinvented the argument for A*, without anyone saying the letter out loud.
We do the same exercise on a whiteboard first, markers only, no screens. The ring numbers on the whiteboard have to match the ring numbers in the game exactly, or the whole point falls apart.
There's a second algorithm hiding in how the game scores you, and I like this one because it's a little unfair. The hero always takes the shortest route to whatever book you clicked, so the only way to lose points is picking a bad order to collect them in. Par is set by a robot librarian that always walks to the nearest book next, straightforward greedy logic, and greedy never looks ahead. Which means a kid with a smarter order can beat it. I've seen them plan a better route than the robot on the first try, no vocabulary for the Traveling Salesman Problem, no idea that's what they just solved.
Representation is a feature, not a footnote
The Secret Stacks is built for Black and Brown kids. I teach in a Boston neighborhood full of them, and most have never been handed a game, a class, or a tool that was built for them first, not adapted for them later. That's not a footnote. That's the actual reason I built it.
The shelves hold The Snowy Day, Hair Love, Last Stop on Market Street, New Kid, Ghost, The Crossover, Esperanza Rising, Sulwe, Tristan Strong, Amari and the Night Brothers, Brown Girl Dreaming, The Proudest Blue, books where the kid on the cover looks like the kid holding the mouse. For older readers there's a classics genre that folds in the canon they'll meet in school anyway: Their Eyes Were Watching God, I Know Why the Caged Bird Sings, A Raisin in the Sun, The House on Mango Street, The Outsiders, To Kill a Mockingbird, The Great Gatsby. I'd rather they meet Zora and Maya in a game first, not cold, for a grade.
Collecting a book drops an affirmation naming someone real: Mae Jemison, Katherine Johnson, Misty Copeland, Arturo Schomburg. I'm hoping for a specific kind of interruption, a kid stopping mid-game to ask who Arturo Schomburg was.
Click your hero five times and a crown shows up, no explanation given, because I wanted it that way. There's a word, close enough to "Wakanda" to guess, that turns your hero's aura purple. The victory melody borrows its opening notes from Lift Ev'ry Voice and Sing, close enough that if you know it, you know it, and if you don't, it's still just a nice tune.
The one I'm quietly proud of lives in the database. There's one more book than any level shows on screen, Hidden Figures, sitting at `level = 0`, and no starter query on the sheet ever surfaces it. It only shows up if a kid gets curious enough to drop the WHERE clause entirely and ask the database for everything, no filter, no exceptions. Do that and a golden book appears worth triple points, named after the NASA mathematicians the movie is about. I built that one specifically for the kid who ignores the assignment and starts poking at things on their own. That kid is the whole point.
What's Next?
This isn't the end of The Secret Stacks. I'm turning it into a real course next, and I want to bring it back in person at the Boston Public Library, to a room full of kids instead of a browser tab. If you know a library, a classroom, or a kid who needs this, I want to hear from you.