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.
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.
Note
Look at how they move as they have they on life.
Note
Even agressive behaviors can spawn.
Note
In the end this is how the emulation is presented.
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
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 |