Introducing Typomatic

What is Typomatic?

Typomatic is a typographic automatic computer.

Huh?

Okay, bear with me here...

A quick intro to computation

What does it mean to compute something? Roughly speaking, it means to manipulate information by following a routine. That’s a pretty vague definition, but there are lots of ways to make it more concrete. One of the simplest ones was invented in the 1950s by a Russian mathematician named Andrey Markov Jr.

In Markov’s model, “information” means a string of symbols, like this:

oo<<

A “routine” is described by a table like this:

fromto
+<<+
o<<+o
<
o

Each line in the table describes a rule for manipulating the string. To apply a rule, you look through the string from left to right until you find a piece that matches the thing in the from column. Then, you replace that piece with the thing in the to column. Here’s how you’d apply the second rule in the table above to the string I mentioned earlier:

From this...to this!
oo<<o<+o<

Sometimes, of course, the thing in the from column doesn’t match any piece of the string. In that case, the rule can’t be applied.

To follow the routine described by a table of rules, you look through the table from top to bottom until you find a rule you can apply. Then you apply that rule, go back to the top of the table, and start again. Eventually, if you’re lucky, you’ll get to a point where none of the rules can be applied. Then you’re done!

Here’s what happens when you use the rule table above to manipulate the string I mentioned earlier. The first step should look familiar:

StepFrom this...to this!Rule
1oo<<o<+o<2
2o<+o<<+o+o<2
3<+o+o<<+o+<+o2
4<+o+<+o<+o<++o1
5<+o<++o<+<+o++o2
6<+<+o++o<<++o++o1
7<<++o++o<++o++o3
8<++o++o++o++o3
9++o++o++++o4
10++++o++++4

At this point, none of the rules can be applied, so you’re done! As you bask in the warm glow of accomplishment, however, you may begin to wonder what it is that you’ve accomplished. Literally speaking, all you’ve done is turn the string oo<< into the string ++++ by shuffling symbols around. When you look at it in a certain way, though, the game you just played takes on a deep significance.

I could tell you what that significance is, but it’s more fun if you figure it out for yourself. A good way to start is to see what happens when you use the rules above to manipulate the following nine strings:

o<o<<o<<<
oo<oo<<oo<<<
ooo<ooo<<ooo<<<

Unfortunately, all that symbol pushing is going to get tedious pretty quickly. It would be nice if you had a machine that would apply the rules for you, so you could concentrate on understanding what’s going on. That’s where Typomatic comes in.

Computing with Typomatic

Let’s use Typomatic to carry out the string manipulation we did by hand in the previous section.

First, we need to put our table of rules into a format Typomatic can understand. Paste the following four lines into the rule editor at the bottom of the Typomatic page:

+<<+
o<<+o
<
o

Each line describes a rule, with the from and to parts separated by a single tab or space character. You can use any Unicode character except tab and space in your rules. Blank lines and lines starting with two tabs in a row are ignored, giving you a way to break your code into sections and write comments. (Since most web browsers use the Tab key for navigation, the rule editor has its own Tab button. Tabs or spaces at the end of a line can be left out, as shown in rules 3 and 4 above.)

Click the Load rules button above the rule editor. Typomatic will disable the button to show you that the rules you’ve written are in use. (If Typomatic has trouble reading the rule table, it won’t load the new rules. Instead, it’ll leave the Load rules button enabled and show an error message next to each line where it found a problem.)

Type the input string oo<< into the Input field at the top of the page and click Load (or press Enter). The input string will appear in big characters below.

Now, click Play. Typomatic will start manipulating the string you see by applying the rules you loaded. If it gets to a point where none of the rules can be applied, it will stop automatically. You can stop it yourself by clicking Play again. You can also click Step to run one step at a time.

If Typomatic doesn’t respond as expected when you click Step or Play, make sure your latest rules are loaded. Check the formatting of your rule table: if a rule is formatted wrong, Typomatic won’t apply it in the way you expect. Finally, remember that string manipulation routines can be confusing. Make sure there really is a rule that ought to be applied!

Computing with Typomatic like a boss

Now that you’ve got the hang of Typomatic, let’s check out its advanced features.

Stopping rules

You can use the kind of routine you’ve seen so far to do sophisticated computations, but some simple tasks are disconcertingly out of reach. For instance, there’s no routine that will stick a single & onto the front of your input string and then stop. That’s because I forgot to tell you about a tiny but essential piece of Markov’s model of computation: stopping rules.

The table you use to describe a routine is allowed to have a third column, like this:

fromtostop?
~xx~
~oo~
~]%
[~
Every time you apply a rule, you check for a % mark in the stop? column. If you see one, you don’t bother going back to the top of the table and looking for another rule to apply. You’re done! A rule with a mark in the third column is called a “stopping rule,” and you can have as many of them as you want.

To mark a rule as a stopping rule in a Typomatic rule table, just add a % character in a third column, separated from the to column by a single tab or space character. When Typomatic applies a stopping rule, it automatically stops running. You can start it again by clicking Step or Play. If you’re running one step at a time, stopping rules won’t have any noticeable effect, because Typomatic would’ve stopped after one rule anyway.

Sounds and colors

Stopping is the most computationally important thing you can make Typomatic do when it applies a rule, but it isn’t the most entertaining. You can make Typomatic play a sound when it applies a rule by adding a fourth column with one of the six sound symbols:

. + / $ # *

You may have noticed that when Typomatic applies a rule, the piece of the string being replaced flashes white for a moment. You can make the flash a different color by adding a fifth column with one of the six color symbols:

p o y g b v

As usual, columns are separated by a single tab or space character. If you put two separators in a row, Typomatic reads a blank column in between.

Tempo control

Typomatic applies rules on a steady beat, at a default speed of 240 beats per minute. You can make it go faster or slower by adjusting the Tempo slider at the top of the page. The tempo changes in increments of 60 bpm, up to a maximum of 480 bpm.

You can do anything

With Typomatic on your side, you can do any computation that can ever be done, and make silly noises while you’re at it. All you need is patience, practice, and a little ingenuity. Go crunch some strings!