# Fish School

> Forty fish swim in a ring round a target, the milling of real schools. Drag the target and the school follows.

A school of fish has no leader: each fish reacts only to the fish near it and to its surroundings. Some species swim in a rotating ring, a mill, and simple rules give the same shape (I. Couzin and colleagues, "Collective memory and spatial sorting in animal groups", 2002). In this document each of the 40 fish feels four forces: a pull towards a circle of radius 1.2 round the target $(p, q)$, a push across the line to the target that makes it swim round, a repulsion from each other fish, and a small random push.

The random pushes come from a fixed sequence, so the school is the same on every open. The state $S$ holds the positions and the velocities of the fish. The action "swim" advances the school three steps every 30 ms, and "restart" scatters the fish again. The repulsion $c$ spaces the fish: with a large $c$ the ring widens, with $c$ near 0 the fish crowd together. Drag the target: the school follows it and forms its ring again.

- [Open the interactive version](https://graph-paper.io/showcase/en/fish-swarm)
- [Learn more on Wikipedia](https://en.wikipedia.org/wiki/Shoaling_and_schooling)
