Last month I wrote a post on the importance of context when teaching and learning mathematics, especially as it applies to games. My primary point was that the mathematics needs to be embedded in the gaming experience in order for the math to stick in the player’s head. Games that pull the player out of the primary gaming experience to solve math problems do not teach the mathematics as effectively as they could. They also reinforce a sense that mathematics isn’t relevant.

As it turns out, I’ve written two games that feature a great deal of mathematics: *A Beauty Cold and Austere* and *Junior Arithmancer*. In this post I’ll talk about how I wove math into these two games – what I think I did right as well as what I think I did wrong.

First, *ABCA* and *JA* are both parsed-based interactive fiction (IF). This is an old genre of computer game, dating back to the 1970s. The player’s experience with the game is mediated almost entirely through text, rather than graphics. Playing parser-based IF is a lot like reading an interactive book, where you type in what you want the player to do. For example, if you happen to find yourself in a room with, say, a battery-powered brass lamp, you could type

GET LAMP

and the game would transfer the lamp to your inventory, while giving you a response such as

Taken.

So, there’s one aspect of *ABCA* and *JA* that’s different from a lot of math edutainment games: They’re both text-based rather than graphics-based. In the late 2010s, that will unfortunately limit the appeal of the games. On the other hand, that also means that I can create the games myself and distribute them for free, without having to depend on and pay artists, graphic designers, and others. (Not that I have anything against artists or graphic designers; it’s just that I don’t have the time or money to direct a major software project involving multiple people.)

In *A Beauty Cold and Austere* you play the role of a college student taking a survey course in conceptual mathematics. You’ve blown off the course all semester and are now facing an oral final exam in the morning. Tired of studying, you fall asleep – and you dream your way through the history of mathematical thought. The gameplay involves solving a series of (mostly) mathematically-related puzzles. By the time you’ve completed the game you’ve demonstrated an understanding of a variety of areas of mathematics – such as algebra, geometry, calculus, and probability – and are able to pass your final exam with ease.

(MAJOR SPOILERS FOR ABCA COMING UP.)

For example, at one point in the game you find yourself in the Library of Alexandria.

On the wall are carved numbers from 1 to 100, in ten rows of ten each. It looks like you could push any of the numbers. Next to the numbers is a switch, with two settings: “Remove Number” and “Remove Larger Multiples of the Number.” The switch is currently set to “Remove Number,” although you could easily move it to the other setting by flipping the switch. The numbers currently look like this:

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

51 52 53 54 55 56 57 58 59 60

61 62 63 64 65 66 67 68 69 70

71 72 73 74 75 76 77 78 79 80

81 82 83 84 85 86 87 88 89 90

91 92 93 94 95 96 97 98 99 100

At the bottom is a challenge from the librarian: “To access the map room, leave just the primes between 1 and 100 by pushing only five numbers.”

More mathematically-inclined players will recognize that you need to use the Sieve of Eratosthenes to proceed here. But you don’t need to have seen the Sieve to solve the puzzle. In fact, I’ve watched more than one player quickly realize that setting the switch to “Remove larger multiples” and then pushing 2 will remove almost half of the numbers. From there, it’s not too hard to figure out what else needs to be done – especially since the game dynamically updates the puzzle to let you know what’s left.

Which is part of the point, really. *ABCA* isn’t trying to give players arithmetic or algebra practice; it’s trying to get people to engage with and explore mathematical ideas. So it needs to be accessible to people who haven’t seen a lot of advanced mathematics.

I guess that last paragraph was a bit of a digression from my theme of embedding mathematics in the game world. But it gets at another aspect of designing a game that features mathematics: The mathematics in the game should itself be interactive – not static. The player should be able to try things and have the game respond in ways that encourage the player to keep playing with the mathematical ideas. It shouldn’t be about merely coming up with the right answer to a math question.

I think the number puzzle here is a pretty good example of embedding mathematics in a game. Its weakness is that it is a “set puzzle”: While it doesn’t commit the error of pulling the player out of the game, it is mostly stand-alone in terms of the gameplay. However, set puzzles are a common feature of parser-based interactive fiction, so the player is expecting them. In addition, Eratosthenes was actually the head librarian at the Library of Alexandria, so it makes sense for the player, while standing in his office, to encounter a challenge that uses his Sieve.

In truth, several of the math puzzles in *ABCA* are set puzzles. I tried to place them in spaces that made sense, though: The main probability set puzzle is in a casino, for example, and a graph theory puzzle is reinterpreted as riding a laser bike through a collection of roads and intersections. And some of the puzzles, such as the calculus/roller coaster puzzle, require information or objects from elsewhere and so are not completely self-contained. I think it’s fine to include several set puzzles in a math-heavy game, but the designer should try as much as possible to integrate them into the game world.

The most embedded puzzle – and thus arguably one of the best in the game – is the meta-puzzle at the very top level of the game’s geography. When you first enter the dream you find yourself standing at a point. Your actions very quickly turn this into a number line. Then, as you progress further through the game and learn more mathematics, this region of the game adds more features – such as a zero, negative numbers, and a few more aspects that I’ll let the reader discover for herself. This top level thus ends up mirroring the development of mathematics that the player is discovering throughout the game. It’s also the source of some of the puzzles the player needs to solve.

There’s more to puzzle design than embeddedness, though. There’s also interactivity and engagement. I’ve heard some refer to this as “juicyness.” The idea is that a puzzle should give some kind of interesting response to everything reasonable the player tries. In other words, the game shouldn’t just spit back a generic failure message to everything except the expected right solution. In addition to this kind of responsiveness, multiple solutions to a puzzle can also help achieve juicyness.

The puzzle where I think *ABCA* achieves juicyness the most is probably the sequences-and-series machine. This one is very much a set puzzle in terms of the player’s first encounter with it. However, the machine is attached to a path that responds to the different settings of the machine’s various dials and levers. Each combination of settings reproduces a different sequence or infinite series of real numbers, and the path changes to lead to the limit of the sequence or the sum of the series. Some of the sequences and series converge and some don’t, and those that don’t fail to do so in different ways. All of these are modeled by the path. There is a particular “right” path outcome in terms of advancing the game, but there are multiple setting combinations that produce it – corresponding, of course, to the sequences and series that actually lead to that right outcome. But the player can fool around with the machine as much as he wants, seeing what the different settings do. Thus this particular puzzle achieves juicyness by featuring both multiple solutions and plenty of responses to “failure” attempts. And in terms of the mathematics, it’s a lot more interesting to think about convergence and divergence in the context of a game world that you’re exploring than it is when you’re manipulating symbols as part of your calculus homework. (Well, more interesting for most people.)

There are several puzzles in *ABCA* that I think are weaker, though. These generally involve fetching the right item for or answering questions posed by a particular character. These include the scenes with Cauchy and Weierstrass, with Hypatia, and with Newton, as well as the puzzle involving logarithms. The Hypatia one in particular could have been better, as at least for the others the player must make a connection between the mathematics they developed and either the objects in the game or the answers to their questions.

But, overall, I’m pleased with *A Beauty Cold and Austere.* There are definitely things I could have done better, but I think it’s a good game in its genre of massive puzzlefest, parsed-based interactive fiction.

This post has already gotten long enough, so I suppose I’ll save my comments on *Junior Arithmancer* for next month.