A particle life simulation written in C. Particle Life explores the concept of emergence, where complex structures arise from simple rules.
If you wish to modify the particle simulation code itself (src/main.c
), you must set up your Conan environment or link dependencies manually. Conan is a package manager for C/C++ and is used in this project to resolve the SDL2 and ZLIB dependencies. Please refer to the official documentation.
cd build
./plife simulation.txt
The runner.py
script automates the creation of simulation.txt
with customizable attributes and runs the PLife simulation.
python3 runner.py -s SIZE -n NUMBER
-s SIZE
: Number of particle types (required).-n NUMBER
: Number of particles per type (required).
Example:
python3 runner.py -s 5 -n 100
-a
,--assortativity
:high
orlow
.-d
,--degree
: Degree distribution (integer).-c
,--clustering
: Clustering coefficient (0 to 1).-k
,--skew-symmetry
:high
,medium
, orlow
.-r
,--reciprocity
: Reciprocity level (0 to 1).-p
,--sparsity
: Proportion of possible edges (0 to 1).
python3 runner.py -s 5 -n 100 -a high
python3 runner.py -s 5 -n 100 -p 0.2
python3 runner.py -s 5 -n 100 -k high -r 0.7
- Sparsity and Degree Distribution: If both are specified, degree distribution takes precedence.
- Reciprocity and Skew Symmetry: Reciprocity is applied after skew symmetry and can override it.
- Modify
build/simulation.txt
to manually adjust particles, the attraction matrix, or epochs. - The
simulation.txt
file can be renamed; specify the correct filename when running the simulation. However,runner.py
usesbuild/simulation.txt
.