Rock Paper Madness

It’s been a while since I’ve posted on this blog. My dad has been sick and I’ve been working on book edits. Between those two things, my posting just fell off the map. But now I feel motivated to share with you the crazy way I have been spending my time over last few days while I should have been writing novels. I’ve been playing Rock Paper Scissors, and I’m addicted.

I should say that it’s not normal Rock Paper Scissors. The rules are a little different. And I’m not running around the streets of Santa Cruz looking for people to duel with. Rather, it’s computer-based, and I’m watching a machine play itself. Does that make this habit worse? Undoubtedly. But there are reasons why I’ve become so fascinated by this game. Strange, remarkable reasons.

It started innocently enough a few years ago when I first came across the variant version of the game called Rock Paper Scissors Lizard Spock, which was apparently popularized by sitcom The Big Bang Theory. Instead of three possible actions, it has five. I also knew about a computer-based version of Rock Paper Scissors (RPS) invented years ago in which squares in a grid played their neighbors and updated their action if they were beaten. I thought it would be fun to see what happened if you played the grid-based game with the two extra states.

First, here’s what happens if you play RPS on a grid. Red is rock. Green is paper. Blue is scissors.

This is interesting in its own right, IMO. Notice how the game results in spiral propagation waves. In certain places where all three actions occur close to each other, you get a little knot of swirly magic. Trippy!

Now here’s what I came up with for Rock Paper Scissors Lizard Spock (RPSLS).

This is even more interesting. You still get the swirls like before, only now they’re different colors. They map out little tiles of activity that don’t invade each other. That’s cool enough on its own, until you realize that spirals of all five colors are eating the little three-color spirals until nothing is left. Furthermore, when the center of a spiral is devoured, it becomes a knot of unusual twistedness in the advancing five-state wave. In effect, you see a phase change in the system, where five-cycles become dominant, and threes are extinct.

The attentive reader may at this point be wondering how you define what action for a cell to pick after it has been beaten by neighbors of two different types. The answer is that you assert that each action is more effectively dominated by one of the two winning actions and you go with that.

So far, so psychedelic. Fun, but what’s to learn? I did this much years ago and put the whole thing down. I only picked the project back up again when I started to wonder what would happen in a game with an arbitrarily large number of actions. Lets say one hundred and three. So this would be more like Rock Paper Scissors, Lizard, Spock Godzilla, Lawn Chair, Absinthe, Creosote, Nasal Polyp… (insert reams of insanity here)… Hamster, Profiterole, Eggplant, Chin. Let’s take a look.

Nice. More diverse little three-cycles. Different kinds of five-cycles. At first sight, it doesn’t look much different from RPSLS. What have we gained?

Heh. What we have gained, my friend, is the door to a digital acid-trip that keeps on giving. Let’s look at what happens if we take the same simulation as above and add just the teensiest amount of mutation, so that the result of a cell update can occasionally be a random value.

Warning, if you suffer from epilepsy a lot, this next video may be not be good for you.

The simulation starts normally enough, but then it starts to get weird and strobey, and the patterns start to get knotted and ugly and strange. It kind of looks like there’s another kind of wave happening in there, but it’s hard to make out because the colors are jumping around all over the place. Could it be that we’re looking at seven-state waves eating the five-state waves? Two phase changes in the same system?

Fortunately, we don’t have to wonder, because I built a little software filter to enable us to find out. It tracks the number of colors cycling in each pixel and tints the cell accordingly. It even calculates the average number of colors cycling in the pixels and shows you the value.

Plus, it’s now safe to up the frame rate without blowing our minds apart (sort of).

Ugly? Beautiful? Just plain wrong? In any case, what this shows is that several exciting things are happening. First, there are multiple phase changes, like we suspected. Green tinted three-cycles are being munched on by cyan-tinted fives, which in turn are devoured by purple-tinted seven-beasts. But on top of that, we’re seeing that mutations within a given spiral beastie can give rise to streaks and discolorations. The features of age. It’s all looking more biological by the minute.

“So what?” you may say. “It’s making my eyes hurt and it looks like you force-fed oil-paints to a bucket full of fungus and goaded it into creating the world’s most hideous petri-dish performance art.”

You’d be right. But on the other hand, it’s a little bit like creating life out of nothing but a handful of bits. These patterns have structure (they’re dependent on their central spirals). They engage in competition. They produce offspring slightly different from themselves. And the level of structure that they seem able to take on seems limited only by the mutation rate you dare to set, and the neighbor radius you use for each grid cell. As a demonstration, here’s what happens if we ramp the mutation rate just a little more.

Eleven-action spiral-monsters are taking over the board by the end. Madness. I can’t think of another type of simulation where you can have as many successive phase changes as you like, or see self-organizing patterns of such complexity that you have to build filters just to watch them grow.

Is it useful? Hell no. Is it a meaningful analog of biological systems that we could use to better understand nature? Probably not. Is it attractive? That depends on how much you like having your eyes pummeled by garish hypnotic waves. But for me, discovering this kind of magic in a simple game is ridiculously engrossing. Here’s what happens when you hide the actual spirals altogether and just look at the cycle-sizes in a 5x time-lapse speed-up of the simulation.

By the end, we have twenty-three action patterns appearing, and the system still hasn’t stabilized.

It does, by the way, in case you were wondering. There’s always some cycle-size that the system maxes out at for a given mutation rate and neighbor radius. But who cares about that? Look at the furry, impressionist chaos that’s happening here! I can’t even fathom half the crazy crap I’m seeing. It’s like a meltdown in a fireworks factory as rendered by Claude Monet on speed. And there is more to see. So much wrongly more.

In any case, you get the idea. A rabbit hole of impressive proportions for the simulation-minded, I’d say. I will never think of little old RPS the same way again. And now my eyes need a rest.

2 thoughts on “Rock Paper Madness”

  1. Could you adjust the algorithm to simulate history of a land? Split the map into sections and take the most common filter colour in one section and apply a race to that section. Then when the section slowly becomes converted by another colour the areas that this occurs within that section could be points of interest where events occur like a battle lost or spy located etc.

    This seems like it could have a lot of applications

    1. I have indeed made a stab at doing something like that. I used similar algorithms to model economics and political consensus, including tribal invasions. Then, when I could reasonably model the rise of empires, I ran it forward into the future to see what happened next. At some point, I’m going to put up a proper blog post about it. The results are a little scary.

Leave a Reply

Your email address will not be published. Required fields are marked *