Game of Life text and image generator generator

I saw this image the other day on Hacker News and Reddit:

Golly Ticker

It’s a Game of Life pattern that prints out “Golly”. Neat, but I wanted my own. After about 5 minutes of playing around with the Golly logo pattern in Golly (a program for experimenting with the Game of Life), I gave up and wrote a program to do it.

The program takes the top and bottom portions of a template pattern (based on the Golly pattern) and positions them, then fills in the gliders between them for the correct number of columns. Then it duplicates the entire pattern for each row. Finally it “draws” some text (using the sample font from here) by deleting the gliders corresponding to empty space.

This was great, but I had essentially created a dot matrix printer that could draw anything, so it would be a waste to not draw images with it. A few lines of Ruby/RMagick code later, I had a program that did just that. Here’s an example using the Reddit Logo (watch it in HD for the best results):

The code is available on GitHub. It requires Ruby, and RMagick for images. Pass it “-s yourtext” to generate a text based pattern, or “-i imagepath” for an image pattern.

Download Golly to open up the generated “.rle” files.

  • elliottback

    This is pretty sweet–but the game of life is Turing complete, right? So you can do anything!!

    • msouth

      That’s a cool iPhone app you’ve got there! But the iPhone is Turing complete, right? So you can do anything!

      There’s a big difference between “can” and “did”.

      • Mike Blume

        That’s a pretty sweet skyscraper you’ve got there! But physics is Turing complete, right? So you can do anything!

        • erik akerfeldt

          That’s a pretty sweet blog post you’ve got there! But Blogs are Turning complete, right? So you can do anything!

          • JT

            That’s a pretty good comment there, but comments are Turing complete so you can prove anything, right?

  • neil

    just in time for Valentine’s day, thanks ๐Ÿ™‚

  • Rayhan

    incredible. you took a cool idea and fleshed out enough code to make it usable for the rest of us. good work!

  • Neoncow

    Would it be too hard to have make the printer in the > shaped configuration like the Golly printer?

    I think that would mean less horizontal scrolling to display your creations.

    • tlrobinson

      It certainly would be possible, just more work, and I’ve already wasted a few hours on this ๐Ÿ™‚

      • MizardX

        Not that much work. Just split the image in half horizontally. Make one pattern that prints out the upper half. One that prints out the lower part, but mirrored horizontally. Mirror the pattern for the lower half and and place it below the pattern for the upper half.

        • tlrobinson

          That’s still greater than zero work.

          It’s open source, go for it ๐Ÿ™‚

  • Diogo

    This is great!

    With that said, I’ll say this: STOP WRITING RUBY IN CAMEL CASE!!

  • andry.tan

    can some one tell me what is this?
    i can not figure out what is this?
    can some one tell me?

    • tlrobinson

      It is a program that generates patterns for the Game of Life simulation. Read the Wikipedia page I linked to for more information on the Game of Life.

      • Andrea Gennusa

        could you make me istruction? i’ve installed ruby. i start windows cmd, go into your rb and rle directory and type: life.rlb -s mytextย 
        i try with lifepattern.rb -s mytext or font.rb -s mytext but nothing happens. please, could you help me?

  • Anonymous

    Awesome! I just made it print out The Song That Never Ends.

  • EddyTheB

    Awesome. Thanks, I now have a scrolling “Cellular-Automata” for the presentation I have to give on the topic tomorrow.

  • Cole

    Hey, thank you for this! It run very well. I’m interested though in the structure of the ship factory that is used for pixel. Do you know what it is called or where I can read more about it? I can’t seem to find it on any of the GOL wikis.


  • Olivier

    Hi, I love what you’ve done…but I can’t get it to work…I get an error…could you help me please ?
    My error :
    C:UsersOlivierDownloadslife-gen-master>life -s test C:Ruby21
    Generating board of size 30×8
    META: #CXRLE Pos=0,0 Gen=0
    META: x = 265, y = 293, rule = B3/S23
    Actual size 8×33
    C:/Ruby21/lib/ruby/2.1.0/lifepattern.rb:98:in `initialize’: Is a directory @ rb_
    sysopen – C:Ruby21 (Errno::EISDIR)
    from C:/Ruby21/lib/ruby/2.1.0/lifepattern.rb:98:in `new’
    from C:/Ruby21/lib/ruby/2.1.0/lifepattern.rb:98:in `writeRLE’
    from C:/Users/Olivier/Downloads/life-gen-master/life.rb:184:in `’

  • 8o7wer Endie

    Does not work for me, I get this error when running it
    C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’: cannot load such file — font (LoadError)
    from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’
    from life.rb:27:in `