Giter VIP home page Giter VIP logo

life-101's Introduction

Life-101

The Life-101 repository is dedicated to a few example projects showcasing emergence, cellular automatons, and just general simulations of apparent life-like behaviour.

Contents

Note: At this time, not all simulations are perfectly responsive to all screens

The Property of Emergence

Image

Emergence or an emerging property is a property that a system or individual has, that the components of said individual or system do not posses. It is the rise of complicated and different behaviour, from a collection of much simpler elements.

Essentially, the combination of small parts with simple rules that when working together yield morse sophisticated functions. Any complex life form is a primary example of emergence/emergent properties: wherein a collection of cells (which they themselves are just proteins and organelles) can develop a complex creature (such as a human) with even more complex behaviours, such as emotion, collaboration and even sentience. The cells and proteins of course posses no such characteristics, yet the simple behaviours and rules of these small components bring together the capability of something much more complex and intelligent.

Particle Life

Particle life is a Python port (and personal implementation) of this video from CodeParade. The code uses the Ursina graphics engine for all rendering and graphics. The code was further optimized with the jit compiler from Numba to allow for smooth performance especially with many particles.

Explanation

The principles of Particle Life were originally inspired by Jeffrey Ventrella's Clusters. Essentially, different classes of particles (represented by the colour of the particle) are randomly initialized with different attraction and repulsion forces between themselves, along with a few other parameters influencing those forces. Jeffrey Ventrella explains the concept from http://ventrella.com/Clusters/ as:

"All organisms naturally gravitate to other kinds of organisms, and likewise are repelled by different organisms. These particles experience attractions and repulsions with other particles of different colors. They cluster into social pods, or scatter and flee, often mimicking biological behaviors."

Primordial Particle System

A primordial particle system is an environment of particles that move and act based on a single equation. Life-like behaviours and properties can be observed, such as the creation of somewhat functioning "cells". The parameters of the motion equation of the particles can be tweaked, which allows for the experimentation and observation of what kind of results and interesting behaviours different settings might achieve.

Explanation

The idea and implementation of this primordial particle system is from this video from IZGartlife. There also exists a research paper on the topic and implementation available here. he code uses the Ursina graphics engine for all rendering and graphics. The code was further optimized with the jit compiler from Numba to allow for smooth performance especially with many particles.

The simulation starts with a given number of particles initialized at random coordinates in the environment. Every particle has:

  • A position (x, y)
  • An orientation Φ
  • A constant velocity v

The constant velocity is the same amongst all particles in the system for a given environment.

Every timestep, each particle will rotate by a fixed angle α

The property that yields such interesting behaviour is that particles are influenced by their neighbours. Every particle has a sensing circle with given radius r, that within that radius will count the number of other particles in both the Left (Top) hemisphere and Right (Bottom) hemisphere. The particle will then turn towards the hemisphere with more particles, expressed by:

sign(Rt-Lt) * β * Nt

Where Rt is the number of particles in the Right hemisphere at a given timestep, Lt is the number of particles in the Left hemisphere at a given timestep, β is a settable angle parameter and Nt is the sum of particles in both Right and Left hemispheres.

The radius of which a particle can sense it's surrounding neighbours is a settable parameter and constant amongst all in the system of a given environment.s

The final motion equation of the particles is thus:

ΔΦ/Δt = α + sign(Rt-Lt) * β * Nt

The position of the particle p in the consecutive timestep pt+1 is then updated by:

pt+1 = pt + ((cos Φt), (sin Φt)) * v

The implementation is slightly different however, as the parameters act within Ursina slightly differently than in the research paper. This is not really an issue, as it just affects the scale of the numbers required to achieve the same behaviour (the parameters such as radius and velocity just needed to be increased by a factor of 10 to act the same). The equation is exactly the same. The particles will also generate with random coordinates only in a set boundary box (they can however be free to move past it).

TODO:

  • Must update READMEs for all different simulations

Conway's Game of Life

  • Must add the final simulation: Conway's Game of Life
    • Must add respective documentation
    • Take images

Responsiveness

  • Must make PPS responsive
  • Improve crude responsiveness for PLIFE
  • Make Conway's GOF responsive

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.