Quick Overview
Lenia is a continuous cellular automaton system inspired by Conway's Game of Life. It extends the concept to continuous space, time, and states, allowing for more complex and organic-looking patterns. Lenia explores the boundary between artificial life and real biology, creating fascinating, lifelike patterns and behaviors.
Pros
- Creates beautiful, organic-looking patterns and structures
- Highly customizable with various parameters and kernels
- Provides a platform for studying complex systems and emergent behaviors
- Offers both Python and JavaScript implementations for flexibility
Cons
- Can be computationally intensive, especially for large grids or complex patterns
- Requires some understanding of cellular automata and mathematical concepts
- Limited practical applications beyond research and artistic purposes
- Documentation could be more comprehensive for newcomers
Code Examples
- Creating a basic Lenia world:
import numpy as np
from lenia import Lenia
world_size = 256
lenia = Lenia(world_size)
initial_state = np.random.rand(world_size, world_size)
lenia.set_state(initial_state)
- Running a simulation for 100 steps:
for _ in range(100):
lenia.step()
# Optionally visualize or process the current state
current_state = lenia.get_state()
- Changing Lenia parameters:
lenia.set_params(R=13, T=10, m=0.15, s=0.015, b1=1, b2=0.3)
lenia.set_kernel("gaussian")
- Visualizing the current state:
import matplotlib.pyplot as plt
plt.imshow(lenia.get_state(), cmap='viridis')
plt.colorbar()
plt.show()
Getting Started
To get started with Lenia:
-
Clone the repository:
git clone https://github.com/Chakazul/Lenia.git cd Lenia
-
Install dependencies:
pip install numpy matplotlib
-
Run the example script:
python examples/lenia_run.py
This will launch a basic Lenia simulation with default parameters. Explore the examples
folder for more advanced usage and visualizations.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Visit Lenia portal for more information
- [2020-10-13] Update Python version with multi-kernel and multi-channel extensions (v3.4 LeniaNDK.py, v3.5 LeniaNDKC.py). To see the most advanced Lenia patterns, run "python LeniaNDKC.py -c3 -k3", and press "B"
- [2020-07-22] Companion video "Lenia: Expanded Universe" available at https://youtu.be/HT49wpyux-k
- [2020-07-14] Paper published in ALIFE 2020 Proceedings at https://www.mitpressjournals.org/doi/abs/10.1162/isal_a_00297
- [2020-05-07] Preprint paper "Lenia and Expanded Universe" for ALIFE2020 available at https://arxiv.org/abs/2005.03742
- [2020-01-13] Major update in Python version: n-Dimensional Lenia. List of changes see LeniaND changes.txt
- [2019-12-14] Lifeforms found in 3D and 4D Lenia https://twitter.com/BertChakovsky/status/1211010576631005184 https://twitter.com/BertChakovsky/status/1209177017096163328
- [2019-10-16] Paper published in Complex Systems journal at https://www.complex-systems.com/abstracts/v28_i03_a01/
- [2019-05-04] Preprint paper updated on arXiv, accepted by Complex Systems journal and waiting for publication
- [2018-12-27] Preprint paper "Lenia - Biology of Artificial Life" available at https://arxiv.org/abs/1812.05433
- [2018-07-19] Ready to run in your browser! https://chakazul.github.io/Lenia/JavaScript/Lenia.html
Lenia
Lenia is a 2D cellular automata with continuous space, time and states. It produces a huge variety of interesting life forms.
There are various versions available. Python, Matlab and web (JavaScript) versions are real-time, interactive, and equipped with statistics tools. Jupyter and R versions are non-interactive and just for demonstration purposes.
Showcase video
Python Version
Fastest version, minimalist layout. Now with GPU support! (Needs Python3 and various libraries)
Matlab Version
Fast version, great tools for statistical analysis. (Needs purchased copy of Matlab)
JavaScript Version
The original program, slow but with most features.
3D rendering using plot.ly
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot