Conway's Game of Life

A man named John Conway invented a cellular atomaton in 1970 that he called Life. This is an attempt to reimplement it in Ruby, as an exercise. Life basically has four rules (quoted from Wikipedia):

  • Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  • Any live cell with two or three live neighbours lives on to the next generation.
  • Any live cell with more than three live neighbours dies, as if by overcrowding.
  • Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

Elements of the Crime


I'm taking a test-driven approach to implementing Life. Because I'm not the world's most experienced TTD guy, this will probably slow down the development process overall, somewhat.


This implementation had its genesis in a code retreat, where half a dozen or so partial implementations in three different languages got me hooked on the idea of creating a complete implementation of Life. I've decided to complete my implementation, and that's the purpose of this project.


I have some ideas for things I'd like to do with a Life implementation at some point, including trying an approach that avoids dealing with data primitives, using separate objects for all automata without need of an enclosing context per se, using concurrency to allow different automata to "life" at different speeds, and introducing evolutionary processes by way of Life rule mutations within a given automaton that are potentially inherited by "children". For the most part, however, the first implementation here will likely be pretty vanilla, though I have chosen to represent a grid by way of a hash of hashes using integers as keys, with (0,0) as a central point on a coordinate plane (probably not the most common way to create a Life grid).


Any code I write for this Life implementation may be distributed under the terms of the Open Works License. See the COPYING file for more information. See the owl.txt file for license text. See the OWL site for further details.