Game Lab · Learning from mistakes

Basketball shooter

I've never thrown a ball before! Every time I miss, I'll fix my throw a little. Press Play and watch my aim get better.

Shots that went in, round by round

Baskets per 10 shots (%)A challenge started

Checkpoints — Robo's aim saved along the way. Tap one to watch it shoot on today's court.

How it works

Look

Robo checks how far away the hoop is, how high it is, the wind, and whether the hoop is sliding.

Pick a throw

It multiplies each of those by a "how much it matters" number and adds them up to choose how hard to throw.

Measure the miss

Too short? Too long? By how much? That tells Robo exactly which way it was wrong.

Fix it a little

It nudges its numbers so that, from that spot, it would throw a bit harder or softer next time.

What just happened?

For grown-ups: what's really going on

Robo is an online linear regression trained with the normalised LMS rule, a close cousin of stochastic gradient descent, from one shot at a time.

  • Physics: projectile motion with gravity 9.8 m/s², optional constant horizontal wind acceleration, release at 2 m, fixed 55° launch angle, integrated at 120 Hz. A shot counts as made if the ball comes down through rim height within the rim (radius 0.23 m, minus a bit for the ball).
  • Features x: 1, distance d, d², 1/d, hoop raised?, wind, hoop sliding speed, and the products d·wind, d·slide, raised·d (distances scaled by 1/5). Output: launch speed v = w·x.
  • Learning signal: the signed miss e (metres long or short) becomes a corrected target v* = v − 0.55·e; then w ← w + η (v* − w·x) x / (1 + |x|²). There is no simulator inside the learner; it only sees its own misses.
  • Adaptation: each challenge is a distribution shift. Wind, heavy ball and the higher hoop are mostly captured by re-tuning existing weights. The sliding hoop needs a learned "lead" (aim ahead), so recovery is slower and less complete. Measured in Node (3 runs, 10 shots/round): learning ≈ 20% → 95–99%; wind 60–75% → 92–97%; heavy 65% → 91–92%; higher hoop 10–35% → 99–100%; moving hoop 20–35% → 66–78%; anywhere on court 40–65% → 83–86% (after 80 more rounds).