Skip to content

adamheins/predator-prey-sim

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
css
 
 
js
 
 
 
 
 
 
 
 
 
 

Predator Prey Simulation

Simulates a flock of birds, similar to the artificial life program Boids. This simulation also introduces a 'predator': a specific type of boid that hunts others, which are known as the 'prey'. Try the simulation here.

Behaviour

The prey move based on a number of rules:

  • Prey like to travel in the direction as each other.
  • Prey like to be close to the rest of the flock.
  • Prey try to avoid hitting others that are too close.
  • Prey flee from predators who get close.

The predators are much simpler, and follow only a single rule:

  • Chase (and kill, if possible) the nearest prey.

Controls

Launch the simulation by selecting the number of predators and prey with which to start, and then press the 'Launch' button. The simulation can be paused and played again by clicking on the canvas. Various parameters can be altered by adjusting the different sliders.

License

MIT license. See the LICENSE file for the full terms.

About

Simulation of prey escaping a predator, displaying swarm intelligence.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published