Paper Plane Designer
Fold a plane with the sliders, then press Throw! How far can you make it glide? After that, 40 robot planes will evolve to beat you.
How the flock did, generation by generation
Metres flown (and % on the pad, once that challenge is on)
Checkpoints — the champion plane of each generation. Tap one to throw it again, with today's challenges.
The champion's family tree — its parents, grandparents and great-grandparents. Tap any plane to throw it.
How it works
40 random planes
Each plane is just five numbers, its genes: wing size, wing tilt, nose weight, throw angle and throw speed. The first 40 are picked at random.
Throw them all
Every plane is thrown in the same pretend air. Lift, drag, weight and balance decide the flight. The distance is its score.
Pick parents
Grab three planes at random; the best of the three becomes a parent. Good planes win more often, but lucky weaker ones sometimes get picked too.
Mix and nudge
A baby gets a mix of two parents' numbers (crossover) and sometimes a small random nudge (mutation). The two best planes are kept unchanged.
Repeat
New flock, new throws. Nobody tells the planes how to fly: designs that happen to fly further simply have more babies.
What just happened?
- In generation 1 most planes stalled, flipped or dived. A few lucky ones glided.
- Each generation, the better flyers became parents. Their good numbers spread through the flock, and the chart climbed in just a few generations.
- The flock found the same tricks a paper-plane expert knows: enough nose weight to stay steady, only a little tilt, and a gentle flat throw.
- When the challenge changed (wind, cave, pad), the old champions stopped winning. The flock didn't need re-programming: the new rules simply picked new parents.
- Engineers use genetic algorithms like this to design real things: antenna shapes, wing profiles, even car parts.
For grown-ups: what's really going on
This is a real-valued genetic algorithm optimising five design parameters against a black-box simulator. There are no gradients and no neural network: the "model" is the population itself.
- Genome: 5 genes in [0, 1], decoded linearly to wing area scale (0.6–2.0), elevator tilt (−2° to 12°), nose ballast (0–4 clips), launch angle (−10° to 45°) and launch speed (4–16 m/s).
- Physics: a 2-D rigid-body glider integrated with semi-implicit Euler at 240 Hz. Lift
L = ½ρv²S·CL(α)withCL = 5αin attached flow; dragD = ½ρv²(S(CD0 + kCL²) + body). Above about 14° angle of attack a logistic blend switches to flat-plate behaviour (CL ≈ 0.9 sin 2α,CD ≈ 1.6 sin²α): the stall. - Pitch: moment coefficient
Cm = Cm0(tilt) − h·CLα sin α, where the static margin h grows with nose ballast (negative with no clips, so the plane is statically unstable and tumbles), plus aerodynamic pitch damping. The trim angle of attack is roughlyCm0/(h·CLα): tilt and nose weight must be balanced together, which is exactly why one-slider-at-a-time tuning is hard. - Safety: airspeed, pitch rate and speed are clamped, angles wrapped, and the flight capped at 24 s. Verified in Node over thousands of random designs: no NaN or runaway values.
- GA operators: population 40; tournament selection (k = 3); blend crossover (BLX-α style, α = 0.15) with probability 0.7; per-gene Gaussian mutation with probability 0.4 and σ set by the "Random nudges" slider; elitism of 2. Your design can be injected as an immigrant.
- Fitness: distance flown (minus a penalty for hitting the cave roof). In pad mode:
100 − 2.5·|miss| − 6·max(0, vimpact − 3), so it must aim and touch down gently. - Headwind: −4 m/s with two sine gusts, which is close to the plane's own gliding speed. Large light wings get blown back, so evolution shifts towards smaller wings and higher wing loading (a faster glide), which is what real glider pilots do with water ballast.
- Measured in Node (seeds 1–5, 30 generations = 1,200 throws): the best-half average rose from 18–30 m to 53–58 m (already 50–55 m by generation 5), the best plane from 43–57 m to 60–65 m. Switching a challenge on at generation 15: headwind dropped the best to about 22–25 m and it passed 27 m within 3–12 generations; the cave roof dropped it to 7–50 m and it passed 40 m within 1–9; on the pad the champion landed softly within 4–8 generations.
- An honest baseline: with only 5 genes, a pure random search over the same 1,200 throws finds a single plane about as good (59–66 m). The GA's real strengths show elsewhere: the whole population moves to good designs (useful when the rules change), and its advantage grows quickly with more genes, where random search drowns. The landscape also has a thin ridge of nearly neutrally-stable designs that sometimes reaches the end of the park: evolution occasionally finds it, random search rarely does.
- The family tree follows parent links back through the population; chains of unchanged elites are collapsed into one node ("kept ×n").