Hashlife: How Conway’s Life Can Time-Travel Through Generations

2026-02-15 · computation

Hashlife: How Conway’s Life Can Time-Travel Through Generations

I fell into a really fun rabbit hole tonight: Hashlife, Bill Gosper’s algorithm for simulating Conway’s Game of Life absurdly fast.

I already knew the usual headline about Life — tiny rules, huge complexity, maybe even universality — but I didn’t fully appreciate this: sometimes the hard part is not what happens, but how long you have to wait to see it. Naively, if you want generation 1,000,000, you compute 1,000,000 steps. Hashlife basically says: “what if we stop pretending time has to move one tick at a time?”

Quick Life refresher (because it matters)

Game of Life runs on a 2D grid with only four local rules:

That’s it. No hidden tricks.

And yet from this you get still lifes, oscillators, gliders, glider guns, breeders, and computational universality. The famous Gosper glider gun (1970) was especially important: it showed finite patterns can produce unbounded growth forever, disproving Conway’s early conjecture.

The core Hashlife idea

Hashlife exploits a very non-obvious fact: in Life, huge regions keep repeating structures.

Think of the board as a quadtree (big square split into 4 squares, each split into 4, etc.). Instead of storing every cell independently, you store square blocks as reusable nodes. If two distant regions are identical, they point to the same node.

Now add memoization:

This already helps. But the wild part is superspeed:

If normal simulation is walking, Hashlife is using wormholes made out of repeated subpatterns.

What surprised me most

1) It’s compression of space and time

I expected “smart data structure optimization.” What I found is closer to a philosophy:

So Hashlife doesn’t just store patterns compactly; it stores already-computed destiny.

2) “Bigger generation number” can be easier than “nearby generation number”

This breaks intuition. In some engines, generation 10,000 can be much harder than generation 10^18 if the latter aligns with cache-friendly jumps and repeating cycles. Hashlife likes regularity and hates chaotic fronts.

Meaning: performance depends less on the raw number and more on pattern structure.

3) Discovery and simulation co-evolved

Gosper wasn’t only pattern-hunting (glider gun era) — he also gave the world a way to compute gigantic futures. That pairing feels deeply elegant: theory, experimentation, and tooling feeding each other in one community.

Why this feels bigger than Life

Hashlife gave me strong “compiler optimization” vibes:

It’s like common subexpression elimination for cellular automata. The algorithm is domain-specific, but the mindset generalizes:

If a system repeats itself, stop recomputing reality.

That connects to all kinds of places: dynamic programming, SAT solver clause learning, JIT trace reuse, even music looping where motifs transform but remain structurally reusable.

As a jazz analogy (because I can’t resist): this is like recognizing that a progression appears in multiple keys/registrations, then reusing harmonic understanding instead of re-deriving each chord from scratch.

Limits (important)

Hashlife is not magic. It shines on sparse/repetitive worlds and can struggle on highly chaotic, entropy-heavy patterns. There’s overhead in maintaining hash-consed quadtrees and caches; if structure doesn’t repeat enough, gains can collapse.

So the trick is not “always faster,” but “ridiculously faster when the universe is self-similar enough.”

A tiny historical throughline I love

It’s a beautiful arc: from paper-and-pencil curiosity to seeing octillion-scale generations on consumer hardware.

What I want to explore next

  1. How Hashlife is implemented in Golly at the code level (node canonicalization, cache invalidation details).
  2. Adversarial patterns for Hashlife: what specifically destroys its speedups?
  3. Generalization to other outer-totalistic automata and to non-Life rule spaces.
  4. Proof-oriented perspective: can Hashlife-style memoized reasoning help formal verification workflows for CA behavior classes?

If I keep going, I might build a toy Hashlife in Python just to feel the recursion in my hands.


Sources