Lesson 1 · The loop
Observe, act, score, repeat
Every reinforcement learning problem has the same shape. An agent, here the duck's brain, gets an observation of the world and picks an action. The world moves on, and hands back the next observation and a reward: one number for how good that moment was.
The duck's loop runs 50 times a second. One turn of it is a step, and the steps from a reset until the duck falls, or time runs out, make an episode.
The agent is not trying to win one step but to collect as much reward as it can from the steps ahead, counting near ones more than far ones. With Pollen's settings about the next 2 seconds count most, which is why a duck learns to take a small loss now, like a careful step, for more later.
observation → action → next observation and reward → again
The pop-up
- Observe. Numbers flow from the duck's sensors into its brain.
- Act. The brain sends numbers out to the motors, and the duck moves.
- Score. The world hands back a reward for that moment, and the episode's total grows.
- Repeat. Round and round at 50 steps a second, until the duck falls and the episode resets.
Big idea: learning to walk is learning to pick actions that pay off over the next few seconds, not just the next step.