# You're reading: Posts Tagged: cellular automata

### Mobile Numbers: Cellular Automaton

In this series of posts, Katie investigates simple mathematical concepts using the Google Sheets spreadsheet app on her phone. If you have a simple maths trick, pattern or concept you’d like to see illustrated in this series, please get in touch.

Spreadsheets are wonderfully versatile, and the fact that I can now carry spreadsheets around on my phone, in my pocket, is a marvellous result of the smartphone boom. I’m always pleased to see so many people wandering around using spreadsheets on their phones (I assume).

So when my Aperiodicolleague CL-P sent me a link to his latest spreadsheet creation, I was pretty excited to find yet another application of spreadsheets – for modelling cellular automata! As we’ve previously written about on this site, cellular automata are systems that have a set of rules to determine how they change over time, on a cell-by-cell basis (spreadsheets are really the natural choice here). While many automata, such as Conway’s famous Game of Life, are 2-dimensional, that’s slightly difficult to represent on a spreadsheet, as you’d need a separate sheet for each point in time. 1-dimensional automata can be displayed on a spreadsheet though, by simply using the top row to represent the cells you’re starting with and then iterating time down the sheet.

CL-P’s spreadsheet models the famous Rule 30 cellular automaton, named for the specific rule it encodes. Stephen Wolfram, of Wolfram who brought you the maths programme Mathematica and many other cool maths things, named the set of Elementary Cellular Automata rules (0 to 31), each using a different pattern of outputs. The rules tell you how the cells in the row above determine the next row – each triple of three cells determines the value of the cells below, and each cell is allowed to be ‘on’ or ‘off’ (much like in Conway’s Game of Life, where the cells are ‘alive’ or ‘dead’). Since there are 8 possible combinations of on/off across 3 cells, the rule is encoded by knowing whether each of the 8 combinations results in the cell below being ‘on’ or ‘off’. These 8 on/off values determine a binary number less than 32, and the rule is named after the number given by the set of on/offs it uses, as 0/1 digits.

Of the 31 possible rule-sets Wolfram determined in this way, 30 is probably the most well-known, mainly because it’s the most interesting. $30 = 00011110_2$, which means if the number given by the three cells above as binary digits is 0,6,7 or 8 then the cell below should have a 0, and if not then it should have a 1.

Some of them end up dying a death pretty quickly (rule 0 is particularly boring – whatever you start with, everything in the second row is dead, and everything after that is dead forever). Rule 30 however, gives a pleasing pattern of shapes and even if you just start with a single ‘on’ cell in the top row, propagates a pattern across the whole sheet. Christian’s found a way to incorporate the statement of Rule 30 into a single formula:

=if(mod(4*[cell above left]+2*[cell above]+[cell above right]-3,7)<4,0,1)

This says, if the three cells above left to right are A, B and C, then if $4A + 2B + C – 3$ (the binary number given by the numbers above, minus 3) is less than $4 \mod 7$ – so, if the number above is 0,6,7 or 8, then don’t colour the cell, and if it’s not then do colour the cell. Conditional formatting is used to make cells with a 1 in turn green, and cells with a 0 will remain white.

Christian’s sheet is here: CP’s Rule 30 spreadsheet

If you’d like to play with it, you can make a copy of it in your own Drive and edit there – we’ve left this one as view-only so you can always come back and get an undamaged version if you make a mess of things. Try starting with different combinations of 0/1 across the top, and make sure you give it a little time to calculate the rest of the sheet – it’s thinking pretty hard for a little phone!

### Patterns and code to make your own cellular automaton scarves now online

If you remember our post about Fabienne Serrière’s amazing Cellular Automaton Scarves Kickstarter back in 2015, you’ll be pleased to hear Fabienne has now put the patterns, and all the code you need to make your own scarves, online on her Ravelry page.

If you have a knitting machine and are prepared to hack it to take code input (you can read Fabienne’s blog to find out how she’s done that), you can use JPG files to generate knitting patterns of your own, or use Fabienne’s code to create cellular automata from a seed row of pixels of your choice. She’s included the code for Rule 110, but I’m sure you could work out your own automata and knit those too. The patterns can also be knitted by hand, if you’re incredibly patient.

### Mathematical Scarves Kickstarter

If you like your accessories ‘provably unique’, check out this mathematically interesting Kickstarter project – KnitYak, aka Fabienne Serriere, is going to generate some knitting patterns for scarves algorithmically, so no two scarves will be the same. They’ve hacked a knitting machine to use cellular automata to generate unique black-and-white patterns, which will be knitted in merino wool using a Jacquard (double) knit, resulting in lovely well-finished pieces by the sound of things (although the scarves start from \$150, so you’d expect something pretty nice).

Check out the video below, and consider chucking some money on the KnitYak Kickstarter page.

### Rock Paper Squiggles

We’ve seen non-transitive dice, and we’ve had cellular automata coming out of our ears (and proceeding deterministically). Now, this:

A post by the CA’s creator describes in more detail what’s going on, although essentially the idea is that red, green and blue are able to destroy each other in a similar way to rock-paper-scissors, and the result of letting them play for a while is quite interesting. My favourite YouTube comment here has got to be the amazing and prescient “I’m high and what is this?”

### A glider on an aperiodic cellular automaton exists!

Good news, everyone! I literally jumped out of my seat and punched the air when I saw this story. It’s as if this site was set up specifically to report on this exact piece of news.