Quiet Herd

Move the fox across a field of grazing deer to the far side. A deer that sees you too near becomes afraid, and fear goes from deer to deer. When too many deer are afraid, the guards come for you.

Connecting
Calm deer Alert deer Afraid deer The fox Guards Tall grass The far side

Reach the far side. Walk slowly, and use the tall grass.

Use the arrow keys or W, A, S and D to walk. Hold Shift to run: it is fast, but the deer notice you from far away. In the tall grass, a deer sees you only when you are very near.

A state in each boid

Each deer is a gen_boid process with its fear as its state: calm, alert or afraid. Each level of fear has its own rules: a calm deer grazes, an alert deer stands and looks, and an afraid deer flees.

A wave that no deer makes

No code makes a wave. A deer looks only at its neighbors: it becomes afraid when it sees the fox too near, or afraid neighbors. The wave of fear comes from these local decisions.

What the neighbors see

The data of a boid is what its neighbors see. The fox shows its speed and if it is in the grass. A deer shows its fear and where the fear comes from. Each deer decides from that data.

The fox is a boid that you control

The force of the fox is a rule of its own: a function that reads your keys. The guards hunt it with the rule pursue of the library.

Read the code of the game.