←

Flock School

Lab 03 · neuroevolution
1Generation
0/50Flying
0Best gaps

Brain of the leader

sees → flap if orange

Training

gaps per generation
  • Best duck
  • Average

Settings

Every duck decides when to flap from what it sees. Space pauses.
More info

What you're watching

Each duck has a brain of a few neurons. Sixty times a second it looks at four numbers: how high it is, how fast it's rising or falling, how far away the next reeds are and how far the middle of the gap is above or below it. If its one output comes out positive, it flaps. The first generation's brains are random, so most ducks flap themselves into the sky or never flap at all.

When the whole flock has crashed, every duck is scored by how long it flew, with a big bonus for each gap it got through. The best go into the next generation as they are, and the rest are their children, with their weights mixed and a few nudged at random. A flock usually gets the hang of it within ten generations. The dashed line shows what the leading duck is aiming at.

Things to try

Your turn. Race the best duck so far on a fresh set of reeds. It never gets tired or nervous.

Smaller gaps. Shrink the gap and watch the flock get worse, then learn again.

One hidden neuron. Even a single neuron can learn this, because the rule "flap when you're below the gap and falling" is simple. Harder problems, like the double pendulum, need more.

Your settings and your best score in a race are saved in this browser; nothing is sent anywhere.