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”.

      • http://www.physics.ucsb.edu/People/person.php3?userid=mike 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 :)

  • http://rayhan.tumblr.com 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.

    • http://tlrobinson.net/ 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.

        • http://tlrobinson.net/ 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!!

  • http://jualonline.cn andry.tan

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

    • http://tlrobinson.net/ 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.

      • http://www.facebook.com/people/Andrea-Gennusa/1785045889 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.

  • EddyTheB

    It took me a minute to figure it out too (I’ve never used Ruby before). You need to type “ruby life.rb -s mytext mytext.rle”. I also had to change the life.rb file, where it says “require ‘lifepattern’” I had to change it to “require File.dirname(__FILE__) + ‘/lifepattern.rb’”. I had to do the same with the “require ‘font’” line.