Giter VIP home page Giter VIP logo

lenia's Introduction

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

lenia's People

Contributors

alexanderpavlenko avatar arkady-a avatar bjorn3 avatar cclauss avatar ccode-lang avatar chakazul avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lenia's Issues

Increase the usage of augmented assignment statements

👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of augmented assignment statements accordingly.

diff --git a/Python/LeniaND.py b/Python/LeniaND.py
index 1c05acc..892d0f0 100644
--- a/Python/LeniaND.py
+++ b/Python/LeniaND.py
@@ -676,7 +676,7 @@ class Analyzer:
 
                 self.density_sum = np.sum(self.polar_density, axis=0)
                 if self.density_ema is not None:
-                    self.density_ema = self.density_ema + self.ema_alpha * (self.density_sum - self.density_ema)
+                    self.density_ema += self.ema_alpha * (self.density_sum - self.density_ema)
                 else:
                     self.density_ema = self.density_sum
 
diff --git a/Python/LeniaNDK.py b/Python/LeniaNDK.py
index 03373fe..8722d87 100644
--- a/Python/LeniaNDK.py
+++ b/Python/LeniaNDK.py
@@ -701,7 +701,7 @@ class Analyzer:
 
                 self.density_sum = np.sum(self.polar_density, axis=0)
                 if self.density_ema is not None:
-                    self.density_ema = self.density_ema + self.ema_alpha * (self.density_sum - self.density_ema)
+                    self.density_ema += self.ema_alpha * (self.density_sum - self.density_ema)
                 else:
                     self.density_ema = self.density_sum
 
diff --git a/Python/LeniaNDKC.py b/Python/LeniaNDKC.py
index 765e00f..038e096 100644
--- a/Python/LeniaNDKC.py
+++ b/Python/LeniaNDKC.py
@@ -751,7 +751,7 @@ class Analyzer:
 
                 self.density_sum = np.sum(self.polar_density, axis=0)
                 if self.density_ema is not None:
-                    self.density_ema = self.density_ema + self.ema_alpha * (self.density_sum - self.density_ema)
+                    self.density_ema += self.ema_alpha * (self.density_sum - self.density_ema)
                 else:
                     self.density_ema = self.density_sum
 

reikna import error

Hi!

First of all, thank you for making this. It's truly amazing. I'm trying to make the Python code run on my computer, but after installing the requirements I'm getting this strange error. Any idea what's going on here?

Traceback (most recent call last):
  File "/home/xxx/PycharmProjects/Lenia/Python/LeniaND.py", line 4, in <module>
    import reikna.fft, reikna.cluda  # pip3 install pyopencl/pycuda, reikna
  File "/home/xxx/PycharmProjects/Lenia/venv/lib/python3.8/site-packages/reikna/fft/__init__.py", line 15, in <module>
    from reikna.fft.fft import FFT
  File "/home/xxx/PycharmProjects/Lenia/venv/lib/python3.8/site-packages/reikna/fft/fft.py", line 11, in <module>
    TEMPLATE = helpers.template_for(__file__)
  File "/home/xxx/PycharmProjects/Lenia/venv/lib/python3.8/site-packages/reikna/helpers/__init__.py", line 158, in template_for
    return make_template(name + '.mako', filename=True)
  File "/home/xxx/PycharmProjects/Lenia/venv/lib/python3.8/site-packages/reikna/helpers/__init__.py", line 100, in make_template
    return Template(**kwds)
  File "/home/xxx/PycharmProjects/Lenia/venv/lib/python3.8/site-packages/mako/template.py", line 338, in __init__
    module = self._compile_from_file(path, filename)
  File "/home/xxx/PycharmProjects/Lenia/venv/lib/python3.8/site-packages/mako/template.py", line 413, in _compile_from_file
    code, module = _compile_text(
  File "/home/xxx/PycharmProjects/Lenia/venv/lib/python3.8/site-packages/mako/template.py", line 711, in _compile_text
    code = compile(source, cid, 'exec')
  File "_home_xxxx_PycharmProjects_Lenia_venv_lib_python3_8_site_packages_reikna_fft_fft_mako", line 148
    def render_insertGlobalLoadsNoIf(context,input,kweights,a_indices,g_indices,pad=,fft_index_offsets=):
                                                                                    ^
SyntaxError: invalid syntax

logo for lenia

Hello there. I design a logo in my free time. I want to design a logo for you. What do you think ? I want to contribute you.

Python (Reikna) GPU support on Windows?

Hello, I am a big fan of your work! Quick question, are there some extra steps I need to take to enable GPU support, at least on Windows? (I would be normally using linux but my dual boot setup is currently broken)

I had to tweak the dependencies to get it to work right, but I'm still using mostly the same install. I also had to install PyCUDA to get Reikna to do anything, I think this is normal but I couldn't find anything about it specifically for Lenia. However, I still get an error saying the compiler preprocessing of the CUDA shaders failed.

I have the latest stable NVIDIA graphics drivers, and an NVIDIA GTX 1650. I tried doing a clean install of the graphics drivers, and all of the CUDA test programs seem to work. Is it possible my GPU or operating system is not fully supported by Lenia Python? Or am I just overlooking something? My adapted requirements.txt file is attached below if it helps. Let me know if you need any more information.

requirements.txt

Host on GitHub pages?

Hi!

First, I'm astonished of lifeforms' beauty.

It seems like there is no Webpack / Babel / other build solution involved. When I cloned the repo, I just opened JavaScript/Lenia.html and it worked.

Please, consider using GitHub pages to host Lenia, so everyone visiting this page could just click a link and check out Lenia for themselves, without cloning the repository.

Last thing once I'd got everything else sorted

I got all the dependencies installed (gentoo Linux using portage had everything apart from renia, so a local renia checkout with $PYTHONPATH specified) and then when I tried to run LeniaND.py (I was keen for the python version), I got a traceback from reikna:

File "/home/dan/dev/python/lenia/Lenia.git/Python/reikna/reikna/cluda/ocl.py", line 114, in _copy_array
dest.set(src, queue=self.queue, async=self.async)
TypeError: set() got an unexpected keyword argument 'async
'

I guess this should probably be reported to the reikna github (if there is one!) but I thought I might as well let you know - and yes, maybe this would have worked if I had a newer nvidia-drivers installed? (currently on 390.87) but the code could also check if that arg is allowed before passing it perhaps?.

I was able to run LeniaND.py fine after removing that single 'async' argument from the call to 'set()' mentioned above.

More advanced constructions

Hello my name is Michael Simkin, I'm game of life enthusiast and (among other discoveries) I've constructed adjustable speed spaceship that solved every speed below c/4 in CGOL.

I really liked your rules collection and the aesthetics of continuous rules. But I see people just invent new rules and don't invest time to investigate the simplest properties of the rules (and maybe meaningful modification in order to support university). For example what are the possible results of two gliders collisions? Is there also oscillators and other gliders in the same rule? How about glider reflector and duplicator? Can we make construction arm and make Gemini in some of your rules? In order to have Gemini we need to implement HashLife algorithm, as Gemini basically means universal construction, and the iterator implementation must be sparse.

CAs are very useful for self replication, and continuous self replication never been explored at all. Maybe there are some interesting shortcuts available in this collection of rules. Maybe we can make a spaceship that can turn in 5% for example. Some interesting properties and search utilities from CGOL can be used to find spaceships in those rules as well.

EDIT I noticed many of the rules contain interesting creatures but random soup is exploding. Do you have a "real" CGOL like rule where:

  1. Spaceships are many times spontaneously appearing.
  2. Random soup is usually (with probability higher than 99%) ends with only oscillators + spaceships.
  3. Infinite explosions are extremely rare (less than 0.1%).
  4. Complete death from random big enough soup is rare (less than 5%).
  5. A large set of different spontaneous creatures are available in the same rule (like in CGOL we have *WSSs except of gliders). And oscillators/still lifes have many different shapes.

how to increase the resolution?

I am using the python version, and could change the code if needed.

if you could point me to documentation that would also be great

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.