Procedural Art
Rock, paper, scissors
Below is an example of a cellular automaton, where each frame of the animation is dependent on the previous frame and a set of rules that determines what each pixel in the next frame will be based its value and the value of its neighbors. In this example, each pixel is either rock (red), paper (blue), or scissors (green).
To calculate the next cell, the neighbors of each cell that would beat that cell in a game of rock, paper, scissors (e.g. paper for rock) are counted. If the number of cells representing that state are above a certain threshold, the cell changes colors to match the winning state. To make the pattern more organic, a random number is added to the number of counted winning cells before it is checked against the threshold.
This sketch is interactive! You can change the winning threshold that determines when a cell changes colors by moving pressing W and S (once you pass 8, it resets to 0). You can also change the range of the random number by pressing A and D (e.g. setting the value to 2 picks a random number between -2 and 2, once again rolling back to 0 after passing 8).
