Raspberry Pi Life Simulator

Using one Raspberry Pi and one 32×32 RGB Led Panel and inspired by my Life Simulator Android App I created a Rasbperry version.

The idea is to parametrize the behaviour of plants (green) and two herbivore species (red and blue) that compete among each other to get the resources and reproduce itself.

The evolution of this artificial ‘ecosystem’ can be seen using the led panel.

In this first version you can parametrize this parameters:

#define PLANTS_LIFE_EXPECTANCY 255
#define PLANTS_RANDOM_BORN_CHANCES 1000 // high value means less chances
#define PLANTS_RANDOM_NEARBORN_CHANCES 100
#define PLANTS_RANDOM_DIE_CHANCES 2
#define PLANTS_ENERGY_BASE_PER_CYCLE 10

#define SPECIE1_LIFE_EXPECTANCY 200
#define SPECIE1_RANDOM_BORN_CHANCES 10000
#define SPECIE1_RANDOM_NEARBORN_CHANCES 100
#define SPECIE1_RANDOM_DIE_CHANCES 2
#define SPECIE1_ENERGY_BASE 10
#define SPECIE1_ENERGY_NEEDED_PER_CYCLE 2
#define SPECIE1_MAX_ENERGY_RECOLECTED_PER_CYCLE 10
#define SPECIE1_ENERGY_TO_REPLICATE 15

#define SPECIE2_LIFE_EXPECTANCY 180
#define SPECIE2_RANDOM_BORN_CHANCES 10000
#define SPECIE2_RANDOM_NEARBORN_CHANCES 100
#define SPECIE2_RANDOM_DIE_CHANCES 2
#define SPECIE2_ENERGY_BASE 10
#define SPECIE2_ENERGY_NEEDED_PER_CYCLE 2
#define SPECIE2_MAX_ENERGY_RECOLECTED_PER_CYCLE 20
#define SPECIE2_ENERGY_TO_REPLICATE 11

The code is based on Peter Onion panel driver, you can take a look at source here:

https://github.com/ferriman/SSandSP/blob/master/raspberrypi/PanelLifeProject.c

Here the video:

 

Posted in Android, C/C++, Electronics, IA, Maths, Programming, Raspberry Pi Tagged with: , , ,
0 comments on “Raspberry Pi Life Simulator
1 Pings/Trackbacks for "Raspberry Pi Life Simulator"
  1. […] user Ferran Fabregas used a Raspberry Pi and single 32 x 32 RGB LED panel to create a Life Simulator. Code is based on Peter Onion panel […]

Leave a Reply

Your email address will not be published. Required fields are marked *

*