Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 docs
Octocat-spinner-32 javascripts
Octocat-spinner-32 lib
Octocat-spinner-32 node_modules
Octocat-spinner-32 patterns
Octocat-spinner-32 spec
Octocat-spinner-32 stylesheets
Octocat-spinner-32 .DS_Store
Octocat-spinner-32 .gitignore
Octocat-spinner-32 CNAME
Octocat-spinner-32 README.md
Octocat-spinner-32 cafeaulife.tmproj
Octocat-spinner-32 index.html
Octocat-spinner-32 params.json
README.md

Cafe au Life

Gosper's Glider Gun

(Gosper's Glider Gun. This was the first gun discovered, and proved that Life patterns can grow indefinitely.)

Cafe au Life is an implementation of John Conway's Game of Life cellular automata written in CoffeeScript. Cafe au Life runs on Node.js, it is not designed to run as an interactive program in a browser window.

If it doesn't produce an animated display, why should I care about it?

Cafe au Life implements Bill Gosper's HashLife algorithm. HashLife exploits regularity, so for certain life patterns, it runs at super-linear speed. As noted elsewhere, if you set up Gosper's Glider Gun when the Earth was first formed 4.5 billion years ago, and ran one generation per second, in the 143.4 quadrillion seconds that have elapsed since then, the pattern would grow to 23,900,000,000,000,036 live cells. Cafe au Life takes just under two seconds to boot up, and another second to calculate the state of the pattern after 143.4 quadrillion generations.

If you haven't seen how the algorithm works, you owe it to yourself to read the annotated source code.

How can I try it?

The easiest way to try Cafe au Life is to install CoffeeScript and node.js, clone the repository, then use the REPL from the command line:

raganwald@Reginald-Braithwaites-iMac[cafeaulife (master)] coffee
coffee> Life = require('./lib/cafeaulife').set_universe_rules()
coffee> gun = require('./lib/menagerie').gospers_glider_gun
coffee> gun.future_at_time(143400000000000000).population
23900000000000036
coffee>

Have fun!

Is it any good?

Yes.

Neat algorithm, but why does Conway's Game of Life matter?

One of the most important questions we ask ourselves is whether a non-trivial machine can be constructed that reproduces itself. If the answer is "no," then we can reason that for any machine, there must be a factory or creator outside of the machine. That goes for humans and all life. If the answer is "yes," then we can reason that it is not necessary for there to be a factory or creator for every machine, including ourselves.

The Recursive Universe

Cellular automata patterns are a kind of machine, with properties close enough to physical machines that it is very easy to reason by correspondence: If such-and-such is possible for a cellular automaton, it must be possible for a physical machine, therefore research into the capabilities of cellular automata is an important part of research into the capabilities of machines, including our bodies and our brains.

Life theorists have proven all sorts of things about what ought to be possible with Life patterns. Life experimenters have taken it to the next level and have built Universal Turing Machines, self-replicating machines, and all sorts of things that demonstrate the universality of Conway's game of Life. Implementations that can handle very large and/or very long-running Life patterns are an important tool for experimentation.

if you'd like to read more, the most approachable book on the subject is William Poundstone's brilliant The Recursive Universe. Beg, borrow, or steal a copy, new or used. Get it in hardcover while you still can.

What should I read next?

The annotated source code.

Who's responsible for this?

When he's not shipping Ruby, Javascript and Java applications scaling out to millions of users, Reg "Raganwald" Braithwaite has authored libraries for Javascript and Ruby programming such as Katy, JQuery Combinators, YouAreDaChef, andand, and more you can find on Github.

He has written three books:

His hands-on coding blog Homoiconic frequently lights up the Hackerverse, and he also writes about project management and other subjects.


(c) 2012 Reg Braithwaite (@raganwald)

Cafe au Life is freely distributable under the terms of the MIT license.

The annotated source code was generated directly from the original source using Docco.

Something went wrong with that request. Please try again.