Skip to content

softwayrdev/PredatorAndPrey

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PREDATOR AND PREY CELLULAR AUTOMATON

The world is grid of cells, with 3 possibilities: Predator(Red), Prey(Green), or Empty(Black).

Both predator and prey have a set health, that changes over time.

The simulation works in steps, with the following rules:

-For prey:
    -Tries to move in a random direction.
    -Health increases.
    -When health reaches a threshold:
        -They will reproduce, creating a new "Prey"
        -Their health resets to 1

-For predator:
    -Tries to move in a random direction.
    -Health decreases.
    -When health reaches 0, they die and turn into "Nothing".
    -If the adjacent square is a prey:
        -They will eat it, turning it into a "predator" (reproducing)
        -Their health will increase by the amount of health the eaten prey had

Image

About

A cellular automaton written in C++/ SFML

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%