Last time you learned the words. Today you meet a real environment — a pole balanced on a cart — and train a policy with your own hands, right in the browser. No library, no GPU: just four numbers and some luck.
Four numbers in, two actions out, +1 for every step the pole stays up. You play it first.
Random guessing sets the bar. A policy with just 4 weights can beat it by a mile.
Random search and hill climbing: generate, score, keep the best — and see why one score can lie.
Why guessing works for 4 weights, fails for a humanoid, and what the loop's gate must respect.
🔑 Big insight: training is just propose → test → keep the best. Everything later (evolution, PPO, humanoids) is a smarter way to do those three words.
📚 Based on "Reinforcement Learning: An Introduction" (Sutton & Barto), Ch.3 Example 3.4, with Gymnasium's CartPole-v1 physics
🖼️ The marker moved up one step: CART.
🖼️ Four gauges tell the state. Two arrows are the only actions.
🖼️ The +1 counter runs while the pole is up and stops when it falls.
🖼️ Coin-flip control earns a tiny bar.
🖼️ Four knobs (weights) → add up → right or left.
🖼️ Many cards tossed, one golden card kept.
🖼️ The same weights: a tall score from 5 lucky tests, a shorter one from 100 fresh tests.
🖼️ On a flat plain every nudge looks the same; a big jump lands on the mountain.
🖼️ Four dials can be guessed. A wall of dials cannot.
🖼️ The gate's margin must be wider than the shaded luck band.
🖼️ 500 steps × 0.02 s = 10 seconds of balancing, computed in a blink.
Choose your challenge level for this course.
Your player's health is low! (您的玩家生命值很低!)
✅ You finished RL Lesson 2 — CartPole, the random baseline, linear policies, random search, noisy scores, and the limits of guessing.