Cafe au Life
(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.
Why should I care?
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, read the annotated source code and learn how the algorithm works.
How can I try it?
You can try Cafe au Life: 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>
You can also play with a browser-based version at raganwald.com/hashlife.
Is it any good?
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.
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?
Who's responsible for this?
Cafe au Life is freely distributable under the terms of the MIT license.