Skip to content

This is a project written in C using the MiniLibX as the API wich simulates life forms

License

Notifications You must be signed in to change notification settings

gecarval/Particle-Life

Repository files navigation

REPOSITORY STATS

GitHub code size in bytes Code language count GitHub top language GitHub last commit

This project is written in C using the MiniLibX as the API.

LifeSim

This program simulates gravitational attraction with defined rules, such as the range of the gravitional attraction and the strenght of this force, being it negative or posivitive, in other words an attractive force or a repulsive force defined by a diametre.

The gimic is that there are thousands of this particles and each one of those will behave diferently (attration or repulsion) acording to his colours, which can be a range between 1 to 6 different ones.

Example

Note

The red line is the range of the repulsive force, and the green one is the attractive force.

The interesting thing is the type of behavior and complex structures that can form from such simple rules that are defined by the programmer, but the result is unprecdicteble from the user stand point, which create patterns from an emergent behavior as the Conway's game of life.

Demo

3 creatures ecosystem

Note

Look at how they move as they have they on life.

Agressive creature

Note

Even agressive behaviors can spawn.

Giant ecosystem

Note

In the end this is how the emulation is presented.

Installation

The project uses the MiniLibX using the X11 Window system in the Linux Operating System, after the instalation of all dependencies you should do as required:

  • Clone the repository;
git clone https://github.com/gecarval/Particle-Life.git
  • Move to the folder;
cd Particle-Life
  • Compile the project;
make
  • execute the program;
./render [Put Window Width] [Put Window Height]
  • execution examples:
./render 800 600
./render 1600 900
./render 1900 1000

Controls

BUTTON ACTION
R Random Rules
T Reset Positions
Y Show Quadtree
LMB activate brush
Esc Exit
[ increase speed
] decrease speed
1 on/off Particle life
Space clear screen

About

This is a project written in C using the MiniLibX as the API wich simulates life forms

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published