Profile picture
, 59 tweets, 13 min read Read on Twitter
Tonight, I'm playing the EverQuest TTRPG—a d20 game from way back in the Great Glut of d20! I have no experience playing the MMO & no nostalgia for the setting, but the GM has plenty of both to spare.

It's been interesting tackling it exactly like characters in a MMO.
But tonight, what I'm most looking forward to, is tracking everyone's position in combat using complex numbers & the Free42 RPN calculator app on my phone.

(This is a calculator thread, by the way.)
I've been trying to teach myself to be more comfortable with complex numbers & this is how I learn math—the same way I learned how to design games—by playing with it.
So for the first 4 decades or so of my life, I was convinced I didn't care for math. I was kind of good at it when it came to making the grade, but I was never really curious about it.

This all changed when I was introduced to RPN calculators: hpmuseum.org/rpn.htm
There was a enough play in that algorithm to spark my imagination. The first one I bought (two, actually, part of a package deal on eBay) was the HP-12c: hpmuseum.org/12c.jpg

A mysterious little bugger full of secrets and hidden tricks.
I took a whole calculus course just because I wanted to know why the [eˣ] button was so damn important.
Programmable RPN calx give me the same hit I got when I first sat down to play a fantasy tabletop roleplaying game.

Here was a world full of hidden, arcane secrets & treasures, a world governed by mysterious, but ultimately knowable rules packaged in an instruction manual.
So here's this app called Free42, which is a "a re-implementation of the HP-42S Scientific Programmable Calculator and HP-82240 Printer." thomasokken.com/free42/

I 💜 it!
I don't have an HP-42s or a HP-82240, but I do have a DM42 and a smartphone, both of which run Free42: swissmicros.com/dm42.php

I don't know if I have a favorite calculator, but I do keep coming back to this very one an awful lot.
So many playful features: hpmuseum.org/hp42s.htm
I want to talk about what I'm playing with tonight and why I think it'll be fun, but I also want to get folks who might be where I was just a few years ago up to speed. There's a significant chance I'm going to fail at one or both of these attempts. Please bear with me.
Feel free to download the Free42 app and play along at home.

Let start with the imaginary numbers—a name loathed by every math teacher I've ever had, but come on, what could be more alluring than a fucking imaginary number?
Imaginary numbers are what happen when you try to take the square root of a negative number.

Any time you multiply any two positive numbers, the result is positive.

Any time you multiply any two negative numbers, the result is also positive.
So, any time you multiply any number by itself, whether it is positive or negative, your result is going to be positive.

This fucks things up when you're trying to find a number times itself that equals a negative number.

So you make up an imaginary number: i.
You say:

i×i=-1

And you push forward.
This is handy, because it acts like any other number, but it does this one weird trick. So you can add it to other numbers, multiply, subtract, divide, the whole deal.

You just have to sort of keep track of it, the same why you might have to track a variable in an equation.
Consider n.

n×2=2n, right?
2n+3=well, 2n+3
4×(2n+3)=8n+12

You keep throwing arithmetic at this and you'll lose track of your 2 and 3, but that's okay, because you know their in there.

No matter what, you know where your n is, because it can't really mix in.
The same with i.

i×2=2i
2i+3=2i+3, which is perhaps more traditionally written 3+2i
4×(3+2i)=12+8i

Except! If now multiply it by i something magical happens.
(12+8i)×i=12i-8, right?

Because 12×i is just 12i, but 8i×i is 8i², and i's whole deal is that when it's squared it's -1.

So 8i² is 8×-1, or -8.

If we'd done this trick with n, we'd just have 12n+8n², which is interesting, but no sorcery.
By the way, -8+12i is a complex number. That is, a number made of a real part (-8) and an imaginary part (12i).

The reason why I keep rewriting it so that the real part comes before the imaginary is also the reason why complex numbers might be of use to a d20 game.
To the dry erase board!

Remember your number line? Positives running off in equal measure to the right forever. Negatives doing the same, but sinister. Zero sitting in the middle.
Remember your xy coordinate plane? Two number lines running perpendicular to each other, crossing at zero.

You may have called that first number line x and its original partner y.

But what if y was actual x×i in disguise?
This would be the same as saying that when you multiplied a number by i, you rotated it 90° counterclockwise in the xy plane.
And that makes a certain amount of sense since multiplying a number by i twice rotates it 90° twice, or 180°. Lifting it from the positive side & dropping it on its opposite on the negative side. Or vice versa.

2 becomes 2i becomes -2. You can keep going!
Real becomes imaginary becomes real becomes imaginary becomes real again. It's the circle of life.
You can represent a complex number on this plane with a point whose x-coordinate is its real part and y-coordinate is its imaginary part!

And these points also rotate the same way when multiplied by I.
You know what else can be represented by an xy coordinate system?

A dungeon grid. A battle map.
Let's call 0+i0 the Origin of the Storm—an arbitrary point chosen at the beginning of a good old fashion d20 fray.

Measure every combatant's location in relation to this Origin of the Storm.
For every foot your PC is east of the Origin of the Storm add 1. For every foot your PC is north of the Origin of the Storm add 1i. West & south are their respective negatives.

If you're 20 feet north and 15 west, you're -15+i20.
On the Free42 you first make sure you're in rectangular mode by pressing [Shif] [Modes] [Rect].

The -15 [Enter] 20 [Shift] [Complex] and save the result in a variable for your PC.
Okay, I've got to step away for a bit to get things done before the game tonight, but when I get back I want to talk about the joys of Polar mode & the programs I've written for this calc to do things like track all combatants, find who's in range of a bard's song & print a map!
Eppy Dabbles in the Complex Plane, Part II: Polar Coordinates
Here's a thing I had to unlearn from grade school math: numbers aren't just the answers to math questions.

Most of grade school math is a game of Find the Number, but that game is really Hide the Truth Behind a Number!
4+3=7, right?

But, like, 4+3=4+3, and that's just as true.

And much more profoundly, 4+3=3+4, which so much more interesting.
Reducing 4+3 to 7 is an act of compression.

It's what you do when you want to tweet about the 3 blue jays & 4 crows you saw fighting over something in a dead tree today, but your description of the tree ran long & you only have enough characters left to say there were 7 corvids.
7 takes 4+3 (or 5+2 or 13-6 or what have you) and wraps it up into a tidy package that's easier to work with.

There's a loss of data, but usually when you wrap an expression up like that, it's because you no longer need that data. 7 corvids unless it matters how many were crows.
Hey, but check this out! 4 is also 4+i0. And 3 can be written as 3+i0.

(4+i0)+(3+i0)=4+3+i0+i0=7+i0

Which, not coincidentally, is also 7.
I mean, it's a bit frivolous to add i times 0 to each of these numbers since anything, even i, times 0 is 0 and adding 0 to anything doesn't change it, BUT...

4, 3, & 7 are living in a 1 dimensional world on that real number line. 4+i0, 3+i0, & 7+i0 are living in 2 dimensions!
Previously in our EverQuest game, we'd been living in a 1 dimensional world. At least when we fought. We'd occupy points on the number line and used addition & subtraction to find our movement & ranges.
A gnome magician starts at 5 feet and their foe is at 140 feet. The gnome has a move of 20 feet & a spell that reaches out 120 feet. Can they target their foe?

I mean the answer is clearly yes, but we're going to use a calculator here, so we need an algorithm.
To find the distance between two real numbers, say G for gnome and F for foe, you just subtract one from the other. The order you subtract them in matters if the direction matters, which it doesn't in this case.

So if G=5+20 and F=140, you can calculate 20+5-140=-115…
Alright, that negative part of -115 is a little inconvenient, but we can get rid of that by using the absolute value function on our calc, which makes negative numbers positive (and conveniently leaves positive numbers alone).
Our crafty gnome magicians knows a "trick" for that if you can't find the absolute value function. Square the number and then find the square root. By convention, when we ask a calculator for the square root of a number, it coughs up the positive one.

-115²=13,225
√13,225=115
But the trick is, it's not a trick. Taking the square root of a square should sound a little familiar.
We call a²+b²=c² the Pythagorean Theorem, but it predates Pythagoras by at least 1,000 years. So that's all lies.

en.wikipedia.org/wiki/Plimpton_…

In a triangle with an angle that measures 90°, c is the side opposite of that angle and a & b are the other two sides: a²+b²=c²
If our gnome & foe are fighting on the complex plane, this theorem is going to come in handy!

Let's pop them out into 2D!

The gnome stands at Gx+iGy & the foe stands at Fx+iFy.

The distance between them is opposite a 90° angle in a triangle whose other sides we can calculate!
One side, we'll call a, is the side that parallel to the real or x axis. The length of a is just the difference of the real parts of each combatant's position.

a=Gx-Fx
The other side, b, is parallel to the imaginary or y axis. It's length is the difference of the imaginary parts.

b=Gy-Fy

It doesn't matter if we subtract the gnome's position from the foe's or vice versa. It doesn't even matter if you switch the order from a to b.
We're squaring both of them so they'll just end up positive anyway.

a²+b²=c²

(Gx-Fx)²+(Gy-Fy)²=c²

So the √(c²) is c, or the distance between the combatants!
Okay, but this is about a calculator, not just math. Specifically, Free42: thomasokken.com/free42/

On the Free42, you can enter complex numbers in pretty easily by keying in the real part first, hitting [Enter], keying in the imaginary part, and then hitting [Complex].
Once you've entered the number in, you can save it in a variable. Say "Gnome" or "Foe" and once it's in a variable, you can call it back up at any time with the RCL key.

Want to know how far your Gnome is from your Foe?

[RCL] Gnome
[RCL] [-] Foe
[Shift] [Convert] [ABS]
This [ABS] function is the absolute value function that removes negatives from real numbers, but if it's dealing with a complex number like a+ib, it gives you the c in a²+b²=c².
Since Free42 is programmable & you're likely to do this quite a few times, you can save yourself a little effort with a quick program:

00 { 11-Byte Prgm }
01▸LBL "Dstnc"
02 -
03 ABS
04 .END.

To use it, just put both positions in the stack and [XEQ] [Dstnc].
That's only the beginning. From there you can whip up programs that track everyone's position and then answer questions like "Who's within range of the bard's song?" or "How far do I have to go so none of those javelins can reach me?"
Ah, but the result of this program is a number, & a wise man once said something several tweets ago about the truth being hidden behind numbers.

Have we lost some data here? Is there something else we're concerned with when asking "How far to run from giants & their boulders?"
Distance is great, but distance & direction is much better!

This, at last, is where polar coordinates come in!
Recall many tweets ago when we said the Origin of Storms was 0+i0, the very center of our centerless plane. We can use our distance formula to figure out how far each fighter is from this spot.

But since this nexus of crisis is made of zeros, we don't even have to go that far.
The [ABS] function takes a+ib and turns it into √(a²+b²) which is the same as √[(a-0)²+(b-0)²], the distance from the Four Winds bar.

We call this value the magnitude because it's that fucking important, and it's the first part of our polar coordinate: how far you are from the Origin of Storms.

Next up, in which direction...
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Epidiah
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!