The Calculator’s Game Design

This blog has seen more traffic in the past 48 hours than all of 2017, and it’s because of a little post about my other hobby, RPN calculators. When I made that post last week, I didn’t even have my DM42 yet. It was ordered it, but still in transit. Now that I’ve had a few days to play with it, and now that I see I have an interested audience, I thought I might say a bit more about it and why I find it so captivating.

But before I do, a brief introduction for all my new readers. Hello there, I am Epidiah Ravachol, author, tabletop roleplaying game designer, and calculator enthusiast. I have written and designed quite a few games over the years. Many of these can be found at the Dig a Thousand Holes Publishing store where until the end of February you can get them for 25% off using the coupon code DM42. You can also get back issues of my sword & sorcery magazine Worlds Without Master—packed with comics, games and weird tales about forbidden sorceries and high adventure. One game you won’t find there (because I published it through another company) is perhaps my most well-known: Dread, the horror game that uses Jenga instead of dice. Finally, I talk about these games, other favorites of mine, game design in general, and my love of calculators and math all over the Internet—on Mastodon, on Twitter, on Google+, on Instagram. I also co-host a podcast about The Rockford Files, for those of you who also happen to love 70s detective shows starring James Garner (which should be just about all of you).

And if you really want to stay up-to-date on my bullshit, sign up for my monthly newsletter!

Right, now on to the gorgeous DM42!

The DM42 calculator as it arrives to you in the mail.

My background is solidly rooted in fiction. I studied fiction in school. I made a career out of writing fiction and designing games that play with fiction. Until very recently, I was under the mistaken impression that math was not my thing. That is was something to power through. A useful tool, but not something to be enjoyed. This changed a couple years ago when I discovered programmable RPN calculators. They lit a near insatiable fire within me to learn as much as I can about as much mathematics as possible.

(If you’re familiar with RPN and programmable calx, feel free to skip the next two sections and check out where I talk about the DM42 in particular.)

Reverse Polish Notation

3 + 2 = 5

Grab the “solar powered” calculator on your desk and key that in. You probably start by hitting [3] followed by [+] then [2] and dutifully the [=] at the end to get your 5. This is known as infix notation and it is what you’re probably used to. The operator [+] goes between the operands [3] & [2].

Reverse Polish Notation, or RPN, is a postfix notation, and it puts the operator in its place, after the operands. In RPN you would key [3] then [Enter] then [2] and then your [+] to get that sweet, sweet result of 5.

No big deal. Probably a little bit different than you’re used to, but you had to learn the infix notation at some point. This is just training yourself to look at a problem in a slightly different way. And that’s always fruitful in and of itself, but for me the true beauty of RPN lies in the stack.

From here on out, my examples are going to be DM42 specific. There are quite a few RPN calx out there, and they can differ in exactly how they work. Here’s how the DM42 handles it.

It has a stack of memory registers, labeled X, Y, Z, and T and arranged like so on your screen:

  • T 0
  • Z 0
  • Y 0
  • X 0

The bottom one, X, is where all the action happens. When you key in [3], is shows up there.

  • T 0
  • Z 0
  • Y 0
  • X 3_

When you hit [Enter] the 3 moves up to Y, but leaves a copy of itself in X, just in case you still need it. It’s thoughtful like that.

  • T 0
  • Z 0
  • Y 3
  • X 3

This time, we have no need for that copy, so we’ll ignore it. When we hit [2] it’ll overwrite it. That’s the power of [Enter]. It lifts the stack, copies Y into X, and then makes it so you can overwrite X with a number more suited to your needs.

  • T 0
  • Z 0
  • Y 3
  • X 2_

Now we key [+] to add Y to X and see our result in X.

  • T 0
  • Z 0
  • Y 0
  • X 5

If we typed in another number now, instead of overwriting it, the whole stack would lift up again, making room for our new number. Let’s try it. Let’s say that instead of 3 + 2, we were trying to solve (3 + 2) ÷ (7 – 1). Key in [7].

  • T 0
  • Z 0
  • Y 5
  • X 7_

The 5 bumps up to Y to make room for the 7 in X. That’s very convenient, but it’s about to get much more convenient. Key in [1].

  • T 0
  • Z 5
  • Y 7
  • X 1_

5 jumps to Z as 7 moves into Y and 1 settles into X. We want to subtract the 1 from the 7 before we divide, so we hit [-] next.

  • T 0
  • Z 0
  • Y 5
  • X 6

And we see the math unfolding before our very eyes! Now for the final result, key [÷].

  • T 0
  • Z 0
  • Y 0
  • X 0.8333

And we get the result 0.8333 etc. in our X register!

Certainly, (3 + 2) ÷ (7 – 1) is not a very particularly interesting calculation. You could have done most of it in your head. But if we had a π instead of 3 or a √7 instead of 7, we would need a calculator. Still, you probably would have been able to do that on the “solar powered” calc on your desk, if you made use of your memory key. But I really dig the way an RPN bounces your previous calculations around in the background, waiting their turn to be useful again.

There are limitations, of course. The stack is only four deep, but you can fit a lot of intricate equations into a four-level stack. And the limits come with some neat capabilities. That T register, which we haven’t used yet, is the end of the line. If we bump a number up out of the T, it’s gone for good. To make up for this, the T is given the power to duplicate. When the stack drops, like when we added 2 to 3 to get 5, whatever number is in T duplicates itself into Z. In our example above, that number was 0. But we can put any number we want in T, either by keying the number in and hitting [Enter] three times, or using the [R↓] key which rolls the stack down so that every number moves to the register below it and the number in the X register moves to T.

Is this starting to feel like a game yet?


All right, consider our old friend the polynomial. Let’s say there’s a formula that you have to calculate over and over again:


Here’s the challenge: How do you solve this without having to enter your x value more than once?

Forget thinking about this as math homework. Wrap yourself instead in fantasy. A 60s sci-fi spy thriller set in the distant future year of 1988. This polynomial is a key, encoded in microdots on a pair of cufflinks gifted to you by your former lover and fellow agent before they disappeared. In your search for them, you find yourself in a secret lair, deep beneath an extinct volcano. Before you are a series cell doors, each completely nondescript except for a value of x engraved on it. You have only your wits and your DM42 at your disposal—a terrifying amount of computing power tucked in your shirt pocket. Whatever it takes to wash the funk of homework out of your mind and let you engage it like the puzzle it is.

Here’s the hint: You can key it in without ever having to touch the [y^x] button.

This is how RPN sunk its hooks into me. Like a well-designed game, it gives me the rules, the affordances and the constraints, and then it shows me just enough tricks to open my mind to the possibilities before letting me run wild with it. I mean, I haven’t even scratched the surface here. The [Last x] and [x<>y] keys alone are complete game changers. But this is where it starts.


When it was first introduced on calculators, RPN was a way to hand some of the computational needs of the calc on to the user. It left the user to interpret parentheses and order of operations, which saved the calc some time, energy and memory. Most of those resources are no long at the premium they were in the 70s and early 80s, but the palimpsest is still there in the DM42.

I’m not a programmer by trade. At least, not a programmer of computers. (We can have the discussion about whether or not tabletop roleplaying game design is programming for the human mind some other time.) But I fucking love programing my calx.

Most of these calx are keystroke RPN programmable. A few are RPL, but that’s another tale. The DM42 is keystroke RPN programmable, which means for the most part it’s programs are just a record of keystrokes and the order in which they are executed. This is a super easy entry point for me. If I know how I would calculate it, then I know how to write a program for it.

To generate a pseudo-random number between 1 and 6, inclusive, on the calculator I would key in:

  • [Ran] An option found in the [Shift] [Prob] menu that generates a pseudo-random number between 0 and 1, exclusive.
  • [6]
  • [×] To stretch that range from 0 to 6, exclusive.
  • [IP] Or Integer Part, a function found on the 2nd page of the [Shift] [Convert] menu that removes everything to the right of the decimal point, leaving an integer without rounding. This gives me a number from 0 to 5, inclusive, with a fundamentally equal chance for any of those values.
  • [1]
  • [+] Shifts my range up to 1 to 6, inclusive.

It’s just like rolling dice, but it takes about 11 keystrokes (both [Ran] and [IP] need extra keystrokes to access them).

Writing this as a program instead requires nothing more than slapping a label on it. Say “d6.” Then, whenever I need to virtually roll a d6 on my DM42, I just have to hit XEQ and select [d6] from the menu options.

If I put a return command at the end of it, I can even call it in the middle of other programs. Like if I wanted to write one that filled a 6×3 matrix with d6 rolls in order to generate old school D&D characters with my calc.

I find joy in the simplicity of this. I can definitely layer on more intricate textures, and boy howdy do I. There’s input and output commands, branching and looping commands, graphics and bit logic, even print commands for an hp82240 infrared printer that I may never, every own. But at its roots it’s just calculator operations in the order you would key them in.

DM42 Features I’m Grooving On

Here are some of the hooks and glories I see in this calc—bearing in mind that I look at it not as a tool, but as a game. I have other calx with all these features and more, and I dig them as well. But the appeal here is the breadth of possibility mixed with a vast unsolved frontier. I dig that you can graph functions on it and I dig that you need to first program it to do so. You have to play with it to reach its potential, but as you play with it the more versatile it becomes. There’s great value in that to me.

  • Variables: In addition to the memory registers in the stack, you can store numbers (and strings) in the numbered storage registers. These are, by default labeled 00 through 24, but you can increase and decrease the number available according to your needs. That’s all fine and good, but the real action is in the variables. You can name your variables things like “Might” or “Magic” instead of numbers. You can store real numbers, complex numbers, alphanumeric strings, matrices & complex matrices in variables. You can write programs that ask for the user to input the values for some variables and use them to calculate the value of other variables.
  • Indirect Addressing: You can throw a number or a string in any register or variable, then you can tell anything that accesses registers or variables to look at the register or variable named within that register or variable! Wait, what? All right, check this out. In register 01 store “Lion” in register 02 store “Tiger” in 03 “Bandit” in 04 “Knight” in 05 “Friar” and in 06 “Dragon” and then run your [d6] program. Then when you indirectly recall what is in the X stack register, it will see what you just rolled and bring up whichever string is associated with that number. Hey, it’s a random encounter chart!
  • Solver: Write a program that throws some of those delicious variables together into an expression or equation and invoke the solver. The solver will ask you for the values of the known variables and for the unknown variable. It then searches for a value of the unknown variable that results in the program barfing up a 0. It’s how I know the real roots of our spy’s polynomial are roughly 0.2483 and -2.1833. If you’d rather know what value will give you 4 instead of 0, add a [4] [-] to the end of your program. One of the first things I did with my DM42 was create a program for a Star Trek game I was playing that would let me solve for the warp factor needed to travel to a destination x light-years away in y days. Or, given the warp factor and distance, how many days it’ll take. Or, given the time spent traveling at a certain warp factor, how far I have traveled.
  • Matrices: I mean, I’m trying to learn linear algebra, so there’s that. But there’s lots of non-linear algebraic applications for matrices in this calc. You can store strings in a matrix entry. So you can get really elaborate with your random encounter tables. There are hidden matrix functions on the calc that let you find where values are located within a matrix and find the maximum and minimum values. You can cut smaller matrices out of bigger ones, and build bigger ones out of smaller ones. You can build tables and charts and menus out of them. Complex matrices can be used to give the graphics commands their x and y coordinates.
  • Rudimentary Graphics: You cannot plug an equation in and have it graph it right off the bat. But you can program it to do so. Or program it to display a smiley face. Or to create a random dice faces based on your [d6] roll. Or any sort of bitmap with 1-bit depth that fits on a 400×240 pixel screen. Go wild!
  • Legacy: The DM42 uses Free42 which is a re-implementation of the HP-42S which in turn is the descendent of the legendary HP-41C. That’s backwards compatibility that stretches back almost three whole decades. There are things that the 42S can do that the 41C cannot, things that Free42 can do that the 42S cannot, and things that the DM42 can do that Free42 cannot, but if you’re careful and aware of those differences, you can can lift just about any program written for the 41C all the way up to the DM42. I love digging through these old, often handwritten, programs that folks were making and sharing over the decades. And I love that you can share your own programs over the internet with other DM42 users or if you’re careful about your graphics, with Free42 users, who could be anyone with a computer or smart phone. That really appeals to me.
  • Saving the Calculator’s State: Finally, on this list, something unique to the DM42, at least among the calx I own. You can save the current state of your calculator. It saves everything. The programs you’re using. The variables you have. The numbers and whatnot stored in your registers. The flags and display modes you currently have chosen. Right down to the numbers in your stack. This is a great way to put one project on hold while you address something else. Or you can create a state built for specific needs, so you can build a financial calculator on your DM42 that you call up whenever you need to make decisions about game production or crowdfunding, or what have you. But what really appeals to the game designer within me is the fact that you can take your saved calculator states, load them onto your computer, and then upload them to the internet. The year is 1981. Skylab II, a secret replica of the Skylab put in orbit by a shadowy government agency has been discovered. It is abandoned, but there are extensive signs of struggle. You are a team of brought together to investigate just exactly what happened here. The only piece of evidence you are allowed to exam is one of the astronauts’ calculators found aboard the station, with all of its programs and variables and recent calculations still on it. If I want, I can make and share that game.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s