Convert Figma logo to code with AI

Chakazul logoLenia

Lenia - Mathematical Life Forms

3,537
221
3,537
8

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

  1. 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)
  1. Running a simulation for 100 steps:
for _ in range(100):
    lenia.step()
    # Optionally visualize or process the current state
    current_state = lenia.get_state()
  1. 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")
  1. 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:

  1. Clone the repository:

    git clone https://github.com/Chakazul/Lenia.git
    cd Lenia
    
  2. Install dependencies:

    pip install numpy matplotlib
    
  3. 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 Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Visit Lenia portal for more information

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

screen cap Watch in YouTube Watch in Vimeo

screen cap Watch in YouTube Watch in Vimeo

Python Version

Fastest version, minimalist layout. Now with GPU support! (Needs Python3 and various libraries)

screen cap screen cap screen cap

Matlab Version

Fast version, great tools for statistical analysis. (Needs purchased copy of Matlab)

screen cap

JavaScript Version

The original program, slow but with most features.

screen cap 1 screen cap 2 screen cap 3

3D rendering using plot.ly

orbium       gyrorbium