Rock Paper Scissors Origins
Rock paper scissors is a simple game that dates back to around 200 BC.
The game is played between two or more players who make a rock, paper or scissors shape with their hand at the same time. Rock breaks scissors, scissors cut paper and paper wraps rock. See this Wikipedia article for loads of info on the game.
Rock Paper Scissors Cellular Automata
Converting the game principals to a cellular automaton is simple enough. This is how I implemented it;
Every pixel color is calculated by playing a virtual 9 player game of rock paper scissors. The current cell vs its immediate 8 moore neighbors. If the neighbor count is greater than a threshold value in the result that beats the current cell then the current cell becomes the winner (what a terrible sentence). For example, if the current cell is scissors, the threshold is 3, and there are 4 rocks surrounding it, then it becomes a rock.
Using the above algorithm leads to very stable exact spiral shapes. The initial grid in this case was the screen divided into 3 “pie wedges”. One for each of the 3 states.
Adding some randomness helps break up the exactness of the spirals. Rather than checking if the winning neighbor count is greater than a specified threshold, check if it is greater than a threshold + a small random amount. This gives more variety in the spirals. This next image used a threshold of 3 and between 0 and 2 added randomly.
Rock Paper Scissors Lizard Spock Cellular Automata
I first saw this variation on The Big Bang Theory.
It was invented by Sam Kass. Lizard and Spock are added in as 2 more possible moves. This results in the play logic..
Scissors cuts Paper, Paper covers Rock, Rock crushes Lizard, Lizard poisons Spock, Spock smashes Scissors, Scissors decapitates Lizard, Lizard eats Paper, Paper disproves Spock, Spock vaporizes Rock, Rock crushes Scissors.
For the cellular automata you add 2 more cell states for Lizard and Spock. Otherwise the rest of the CA uses the same logic as the 3 state Rock Paper Scissors version.
It is interesting that the 5 states do not fully intermingle. Island blobs with 3 of the 5 states seem to form. In the above image there are clearly areas with only red, yellow and orange cells, and then other areas with only red, green and blue cells.
The following is an animated GIF of 45,000 steps (updated 1,000 steps per frame) that shows how these blobs fight for dominance and in this case RGB wins in the end.
RPS 15 includes Rock Gun Fire Lightning Devil Scissors Dragon Snake Water Human Tree Air Wolf Paper Sponge.
Threshold 2 Random 2
Threshold 3 Random 3
RPS 25 pushes it to 25 possible moves.
Threshold 2 Random 8
Threshold 1 Random 4
There is even the insane RPS 101. See the RPS 101 moves here.
I didn’t code RPS 101 as yet.
Image Based RPS
This idea came from NoSocks on YouTube. To use an image as RPS;
Find which of the RGB values is highest for the current pixel. Choose a neighbor at random and find which of its RGB values is higher. R is Rock, G is Paper and B is Scissors. So if the current pixel has the highest G value from its RGB values and the neighbor has the highest B value from its RGB values then the neighbor cell color is copied into the current cell (because B=Scissors beats G=Paper).
You can also use the smallest RGB values.
Here is an example animated GIF of Van Gogh’s Starry Night put through the process (click to open). Source RPS is determined by largest RGB. Opponent RPS determined by smallest RGB value.
Rock Paper Scissors CA and the above variations are now included in the latest version of Visions of Chaos