Skip to content

Processing preydator-preydator-preydator-pr... model

Notifications You must be signed in to change notification settings

f-prettyland/preda-prey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

preda-prey

Written in Processing, this program aims to create a predator-prey model where the top predator gets eaten by the bottom prey. During the model a user can click and hold to draw new in new defection/mutation with their mouse.

3 Groups Fighting Example

20 Groups Fighting Examples with 0.000001% Defection Rate - No Interaction

500 initial tribe cells

5000 initial tribe cells

See animation

Warning: 30 MB gif. Sorry about that.

Running

If you have processing installed as a system package you can simply do:

make run

If you have installed processing to a custom location you can instead do:

make run processing-bin=/path/to/processing-java

Configuration

The sketch looks for a config.json file in the directory that it is run from and will load values if they are present. All configurable values are optional and have sensible defaults which will be loaded unless overriden. Colors are specified as string representation of hex codes with the first digit being the alpha channel and the following digits the standard RGB values.

cellHeight and cellWidth (Integers): Height/Width of each cell that can be occupied.

windowHeight and windowWidth (Integers): Height/Width of the sketch window.

bgColor (String): Background color of the sketch window.

sigils ([String]): Array of colors that corrospond to each different tribe.

initialTribeCount (String): Initial number of tribes at the start of the simulation.

tribesMutate (Boolean): Enable/Disable tribes mutating.

tribesMutateChance (Float): Chance ranging from 0.0 to 1.0 that a tribe will mutate.

saveFrames (Boolean): Enable/Disable saving frames of every generated step to out/frames.

clickMutate (Boolean): Enable/Disable the ability for user to hold down mouse to randomise selected cells tribe.

Details

Colours

There are hard coded colours taken lovingly from Kelly's 22 colours of maximum contrast with the encoding taken from this post. With 22 maximum colours it means with more than 22 tribes that the colours are reused currently.

Todo

  • Expand in 8 directions not just 4
  • Increase values a lot
  • Random colour generation
  • Create user interactable sliders
  • Speed of infection, momentum for travelling waves of success
  • Use this pattern as vector of movement for datamosh

About

Processing preydator-preydator-preydator-pr... model

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published