Shark hunting a swarm of boids in processing.

The boids move by three basic rules:
- do not collide with neighbors/the borders of the screen
- try to swim in the same direction as the neighbors
- don't get eaten by the shark
Every boid has a heart beat (yellow). If the boid is stressed by the shark or by being compressed by its neighbors, the heart beat gets faster. If the boid has many direct neighbors, it gets bigger.

The shark has two rules:
- swim in the direction, where the most boids are
- try to avoid the screen borders

you can download the source code here:
4dcube.de/processing/shark_and_boids

Loading more stuff…

Hmm…it looks like things are taking a while to load. Try again?

Loading videos…