Skip to main content

Heaton Life

heaton-life

PyPI version License Open in Colab

heaton-life is a Python library for exploring emergence: simple rules that give rise to complex, organic-looking behavior. It brings together cellular automata (MergeLife, Life-like, Elementary, Cyclic, and Wireworld), three flavors of Lenia, escape-time fractals with deep zoom (Mandelbrot, Julia, Burning Ship, and Newton), Reynolds boids, and Gray-Scott reaction-diffusion under one consistent API. Every system steps and renders the same way, so a few lines of NumPy-backed code give you a still image, an animated GIF, or an MP4. A genetic evolver can search for new MergeLife rules, and an optional PyQt6 playground lets you explore everything interactively.

Results are reproducible by design. Each system follows a written specification and a set of conformance vectors, so the same parameters and seed always give the same run, and the library's .NET implementation is held to the same vectors. The specifications, the vectors, and the .NET port live in the heaton-life repository.

Here is every system in the library, each rendered by the library itself. The bottom-right tile is the Mandelbrot set at a zoom of 10¹⁴, far beyond what plain floating point can resolve:

heaton-life gallery: one tile per system

Install

Install from PyPI.

pip install heaton-life

Extras: heaton-life[playground] (the PyQt6 app), [precision] (gmpy2 for fast deep-zoom reference orbits; an mpmath fallback is built in), [video] (MP4 export), [fast] (numba kernels).

Sample Code

import heaton_life as hl

# A Life-like automaton from a random soup, rendered to an animated GIF.
sim = hl.ca.LifeLike("B3/S23", size=(256, 256), init="soup", seed=42)
hl.render.animate(sim, steps=500, cmap="phosphor").save("life.gif")

# Deep zoom: float64 pixelates near 1e13; this renders via perturbation + rebasing.
frac = hl.fractal.Mandelbrot(max_iter=5000)
field = frac.render((1920, 1080), hl.Viewport(
    center_re="-0.743643887037158704752191506114774",
    center_im="0.131825904205311970493132056385139",
    zoom_log10=14.0,
))
hl.render.to_image(field, cmap="fire").save("deep.png")

# Zoom movie (also .mp4 with the video extra):
hl.fractal.zoom_animation(frac, (512, 512), hl.Viewport(
    center_re="-0.7435", center_im="0.1314", zoom_log10=4.0,
), steps=90, cmap="fire").save("zoom.gif")

# Evolve MergeLife rules with the paper's objective — reproducible from a seed:
from heaton_life.evolve import Evolver
best = Evolver(size=(64, 64), population_size=20, seed=42).run(max_evals=200)
print(best.genome, best.score)

Playground

pip install "heaton-life[playground]"
heaton-life                        # or: python -m heaton_life.playground

Space = play/pause, N = single step, R = reset, Ctrl+S = save PNG. The parameter form is generated from each family's params dataclass — new families get a UI for free.

Helpful Links

Development

Working on the library itself, from setting up the environment to cutting a release, is covered in the development guide: the lint, type, and test checks, how the specifications and conformance vectors shape every change, adding a family, the tools, and the release workflows.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

heaton_life-1.0.0-py3-none-any.whl (97.5 kB view details)

Uploaded Python 3

File details

Details for the file heaton_life-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: heaton_life-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 97.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for heaton_life-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3325cd8610b502bde4bf65a7269b08663222e57f275fcb0fcae1f6439b839f32
MD5 3292461803ca541173a7b307b41e25f9
BLAKE2b-256 1fdbbce135ff346df4f549c6920595ee4e3162052356e1f5956ec6f1f56634c3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page