“There are a bunch of small worlds, from above, they look like circles, from a level point of view, they look somehow like [ 0 1 0 0 1 0 1 0 ]”
I started my mini-talk at Hiroshima.rb #31 by writing 0s and 1s on the whiteboard.
I’m reading Complexity, a guided tour by Melanie Mitchell and it features those one dimensional cellular automata, of Wolfram fame. I first read about them a while ago, in another excellent book Le Peuple des Connecteurs (sorry, french).
Since it’s a Ruby meetup, I went on and implemented a tool for running those rules in Ruby. It’s called OneDim, it’s there, archived in GitHub.
I wanted to show how I went from the initial problem, and helped by test-driven development, I iterated to a solution. Doing it with Conway’s game of life is a favourite of Rubyists. It’s simpler with one-dimension cellular automata.
Live coding is a bit difficult, instead of inflicting pain on the audience at each keystroke, I simply iterated over the git history of the project. I used a small gmo script to do the navigation, “gmo next” to move to the next commit. (Warning: gmo does reset –hard when switching commits).