In the past two months’ blog posts I’ve talked some about mathematics in games. December‘s focused on the importance of embedding the mathematics in the game world rather than pulling the player out of the game to solve math problems unrelated to that world. In January I wrote up some thoughts about my parser-based interactive fiction game *A Beauty Cold and Austere*, in which the player recreates the history of mathematics via a dream world.

I’ve written another parser-based math game in addition to *ABCA*: *Junior Arithmancer*. While there are some similarities between the two games, *JA* is trying to do something different than *ABCA* does, and so I don’t view it as a sequel or even a follow-up to *ABCA*.

In *Junior Arithmancer* you are (as in *ABCA*) trying to pass an exam. This one, though, is an entrance examination to an institution of higher learning. You have to demonstrate competency in an area of magic, arithmancy; this is done by using various arithmetic-related spells to recreate the first several digits in the decimal expansions of some famous constants, such as , *e*, , and .

For example, the first several digits of are 1, 2, 0, 2, 0, 5. Suppose you have spells that STA (start), PLU (plus), MIN (minus), TIM (times), DIV (divide), and INC (increment by 1). You could start at 1 by using STA 1. Then you could move from 1 to 2 via PLU 1. Then you could go to from 2 to 0 with MIN 2. But now you’re stuck. You can’t use a valid arithmetic operation involving TIM, DIV, or INC (the unused spells) to get from 0 to 2. So STA 1, PLU 1, and MIN 2 only gets you three digits into the sequence.

Let’s see whether we can do better. We must begin with STA 1. There are three options now to get from 1 to 2: We could PLU 1, TIM 2, or INC. Let’s go with INC as the least likely to be needed again. Then from 2 to 0 we could use MIN 2 or TIM 0. Let’s try the latter. From 0 to 2 our only option is PLU 2. Then from 2 to 0 we can’t use TIM again since it’s already been used, but we can go with MIN 2. This is already better than the last time, as we’ve used STA 1, INC, TIM 0, PLU 2, and MIN 2 to recreate 1, 2, 0, 2, and 0 and so get five digits into the sequence. Unfortunately, the only spell remaining is DIV, and you can’t use a division operation starting with 0 to obtain the last digit, 5. So we’re stuck once again.

This example doesn’t use all the arithmancy spells in the game, though; there are others. As you make progress through the exam you earn additional spells. You can also earn spell *prefixes*; these modify the operations of the other spells. For example, if you earn an INV (invert operation) prefix you could effectively gain a second PLU in a single sequence by using the INV prefix to turn your MIN operation into a PLU operation.

Then, after you’ve completed the ten sequences in the game, you’re faced with other challenges: Completing the sequences using only five, four, or even three spells; using spells to reach a number larger than 2 billion; and figuring out the color/number association scheme in the game and using that to visit certain colored spaces, perhaps in a particular order.

From a gameplay standpoint perhaps *Junior Arithmancer*‘s greatest strength is the huge explosion in the possibility space: (1) There are multiple arithmetic operations that can be applied, (2) Applying them in different orders produces different sequences of digits, and (3) Each operation’s effect can be modified by one of several prefixes. So, after STA 1 to begin recreating , you may have something like seven spells to choose from with five possible prefix modifiers (six counting the spell’s basic effect), for a total of 42 options for the next spell. After using one of those you might have six spells left, again with those five possible prefix modifiers plus the spell’s basic effect, for a total of 36 options. So now we have 42*36 = 1512 options for a two-spell sequence after STA. The third spell after STA will have 30 options, bringing our total number of three-spell sequences after STA to 1512*30 = 45360. And this continues growing, to 45360*24 = 1,088,640 four-spell sequences after STA and then to 1,088,640*18 = 19,595,520 five-spell sequences after STA. Not all options are possible, and some duplicate each other, but this gives us a ballpark figure for how many five-spell sequences there are in the game. You also have to be looking ahead, since once you use a spell you can’t use it again on a sequence.

Another feature of *Junior Arithmancer* is that it is “juicy” in the way I described in my January post: Once you understand the rules of how the spells function, every one of those many, many spell combinations actually does something meaningful in the game. I was helped greatly in this respect when designing the game since I was able to use the same arithmetic operations we all already know: I did not have to create, *ex nihilo*, somewhere on the order of 20 million different sequences of spell effects.

How does *Junior Arithmancer* stack up in terms of embedding the mathematics in the game world? Well, you’re taking an exam in the game, so it’s not as embedded as with the two examples I gave in my December post (the one with my real estate agent and the one with the Brazilian boys). With that caveat, though, I think it does a good job of achieving embeddedness. Your goal is to recreate several sequences of digits, and the only way to do so is to find creative ways to perform a set of arithmetic operations in a certain order. You’re constantly having to think and rethink about arithmetic. (Some of the other spells and modifiers make things more complex, so you’re not always working with single-digit numbers.)

Does *Junior Arithmancer* teach anything, though? Not in the way that I tried to do with *A Beauty Cold and Austere*: The arithmetic in *JA* is mostly elementary-school level. The few exceptions don’t require anything more complicated than an understanding of how arithmetic works with negative numbers. So the game is probably too complicated to be used to teach arithmetic to children effectively, In addition, players interested enough to engage *JA*‘s number puzzles probably know arithmetic well enough that they don’t need the practice *JA* provides.

But I think there’s a place for math in games that don’t have an ulterior educational motive, too. Mathematics has plenty of power as a tool to solve problems, but it’s also one of humanity’s great inventions in its own right. Why not mine it for game ideas – for fun – and use it as a sandbox to play in?

Pingback: Five Theses on Mathematics in Games | A Narrow Margin