pattern.png

ELEmentary Cellular Scarf

While I was living in Scotland after graduating from university, I learned to knit. Just the basic stitches, nothing fancy, but I never had a project to work on. This tidbit is relevant, I promise.

Fast forward to about a year later and I'm back living in England. I saw a video from SingingBanana, a maths-based YouTube creator, about a new train station that opened in Cambridge, with a pattern "derived from John Conway's Game of Life".

I assume by that they meant that it's a cellular automaton, of which the Game of Life is probably the most famous (it's certainly the first one I had heard of, and had got me interested in the subject). The pattern on the train station is actually based on Stephen Wolfram's Rule 135, which a simple cellular automaton that generates a complex, organic-looking pattern.

I liked how the pattern looked, and thought it would make for an interesting scarf pattern, especially if the starting value of the automaton were the ASCII values of my initials. So I decided to write a simple Python script to generate a knitting pattern for me.

Unfortunately I was beaten to the punch by KnitYak, who is doing something much cooler by having a machine that calculates the automaton as well as knitting the scarf, but doing it myself will no doubt be both fun and rewarding, not to mention a great deal cheaper.

Source Code

The script I wrote is hosted on GitHub here. I wrote it with Python 3.6.2, and used Pillow for writing the image to a file.

The script accepts 3 parameters:

  1. The rule to use, which defaults to 135.
  2. The number of iterations of the rule (or the number of rows in the image), which defaults to 256.
  3. The string to use as the initial value, which defaults to "JZF"

I'll update this page with the progress I've made on the scarf when I start knitting it.