🏄 foil pilot — stickman learns to foil

gen 0 · agent 1/24
best 0.0 m · now 0.0 m · 0.0 m/s
fitness / generation
| | ↑/↓ weight shift · space = pump

what is this

A 2-D wing-foil simulator and a tiny neural policy that learns to fly it, entirely in your browser, no libraries. The board starts on foil at 5 m/s; the rider must pump to keep speed and shift weight to hold the hydrofoil at a sweet depth. Touch the water → crash. Pull the foil out of the water → stall. Both end the run (with appropriate ragdolling).

the objective

fitness = distance (m) + 4 × seconds near sweet foil depth (0.45 m) − 3 × pump-seconds

the learner

Policy: MLP 6 → 12 tanh → 2 (110 weights). Inputs: board height, vertical speed, pitch, forward speed, foil depth, local chop. Outputs: weight shift (pitch rate) and pump. Trained by a plain evolution strategy: population 24, each evaluated for one episode (max 12 s), top 6 kept, the rest refilled by Gaussian mutation (σ = 0.15) of random elites, plus one fresh random each generation. Every run you watch is a real evaluation. Random policies die in seconds; give it ~20 generations (crank to ×16).

the physics

dt = 1/60 s · mast 0.9 m · 90 kg all-up · lift = 294·v²·α (α = pitch + trim − vy/v, stalls past ±0.35 rad, ventilates when the wing nears the surface) · drag = (3 + 60α²)·v² · pump thrust ≤ 170 N. Level flight needs ≈ 5 m/s — stop pumping and you sink.