Chapter 03 · Part I · Foundations

Thinking Ahead

States, branching futures, and how patience reshapes every decision you make.

In the last chapter, every choice lived in a kind of Groundhog Day. You pulled a glowing lever, collected whatever treat popped out, and the room snapped right back to the exact same starting moment. Pulling Lever A never moved you to a different room, never locked a door behind you, and never opened a hidden hallway.

Real worlds don't sit still like that. Turn left at a street corner and you are suddenly in a new neighborhood. Move a knight in chess and the entire landscape of possibilities shifts beneath your fingertips. Spend your energy sprinting up a hill and you arrive at the top with a great view—and tired legs.

To capture this richer kind of world, we add two simple visual ideas to our loop: a state (a snapshot of where you are right now) and a transition (how your action carries you from one snapshot to the next). The moment actions change your state, a good decision is no longer just about the treat right in front of you—it is about which future doors your step opens.

The Present-Only Rule

Before an agent can think ahead, it faces a surprisingly practical question: how much of the past do I need to remember in order to choose wisely right now?

Imagine walking into a quiet room and seeing a chessboard mid-game. You didn't watch the first twenty moves. You have no idea whether the white knight hopped there in two turns or wandered around the board for ten minutes. Yet if someone asks you to pick the best next move, you have everything you need right in front of your eyes. The current arrangement of the pieces holds the entire story that matters for the future.

The Present-Only Rule

A well-chosen state is a complete snapshot of right now. Once you know the current state, the winding path you took to get here no longer changes what could happen next.

What if a single frozen photo isn't enough—say, a ball suspended in mid-air? You can't tell from one still frame whether it's rising or falling. The fix is simple: include its direction of motion inside the snapshot, and the Present-Only Rule holds once again.

This rule is a quiet superpower. It means an agent doesn't need to carry a giant diary of its entire life history just to decide its next step. Every tile on a map, every board position, every snapshot of the present stands on its own two feet.

Why Tomorrow Feels Smaller Than Today

Now suppose your agent stands at a crossroads. One path hands over a modest snack on the very next step. The other path asks you to walk down four quiet, empty stepping stones before you finally reach a towering Grand Feast.

Which path should the agent choose? It depends on a single, deeply human trait: Patience.

Picture a warm lantern glowing at the far end of a long hallway. Stand right beside it and its light is dazzling. Step back one pace and it softens. Stand five paces away and it's only a gentle shimmer. In reinforcement learning, future rewards behave just like that lantern—each step away from the present dims their pull a little more. We call this Future Fade.

Drag the Patience slider below and watch how the exact same world produces two completely different decisions. Look closely at the glowing bars above each stepping stone: they show how big each prize feels once its light fades backward to that spot.

Lab 3.1 The Fork in the Road: Short-Term vs. Long-Term
56%

Every step backward shrinks a reward's glowing bar by your Patience setting. Slide from Live for Today to Long-Term Thinker and watch the exact tipping point where the agent abandons the quick snack for the grand feast.

Agent's Choice:Quick Snack (Top)
Mindset:Short-Sighted

Notice something remarkable: we didn't change the size of the Quick Snack, we didn't shrink the Grand Feast, and we didn't move a single stepping stone. All we changed was how quickly the future fades with distance. Yet crossing that subtle tipping point around 71% completely flipped the agent's plan.

A Subtle Benefit of Future Fade

Even when an agent is very patient, letting distant rewards fade just a little keeps it from procrastinating forever. A feast reached in five steps glows slightly brighter than the same feast reached in fifty—so the agent naturally prefers shorter, crisper paths over endless wandering.

When the World Doesn't Always Listen

In the fork above, the world was completely predictable: step up and you always land on the top stone; step down and you always land on the bottom stone. But real environments have a mind of their own. Gusts of wind push drones sideways. Wet floors turn a careful step into a slide. Even in games, dice roll and opponents surprise you.

When transitions are uncertain, a single action no longer points to one neat destination—it fans out into a bundle of possible futures, some likely and some rare. Choosing wisely means looking at all the places your step might carry you, and weighing how much you want each one.

Imagine standing on a cliff edge looking toward a Golden Chest across a canyon. Straight ahead lies a narrow wooden bridge—just four quick steps to the treasure! Below the planks swirls cold, choppy water. Looping high above the canyon is a sturdy Stone Detour: twice as long, but completely sheltered from the wind.

Drag the Wind slider in the lab below. On calm days, the narrow bridge glows with golden promise. As the crosswind picks up, watch the translucent slip arrows grow thicker on the bridge planks, watch the bridge tiles cool down, and see the moment the agent wisely abandons the shortcut for the safe stone road.

Lab 3.2 The Slippery Bridge: Uncertainty in the World
6%

Tile brightness shows each spot's expected worth. On the wooden planks, faint arrows show where a gust of wind might push you sideways into the water. Watch the glowing route switch from the daring bridge to the safe detour!

Chosen Route:Daring Bridge Shortcut
Bridge Safe Arrivals:—
Bridge Splashes:—

Hit Test 20 Trips at both low wind and high wind to feel why the agent switches strategies. Even a modest crosswind on each plank compounds across the whole bridge—three chances to slip adds up fast! Meanwhile, the Stone Detour takes a few extra steps (so its golden glow fades slightly more), yet it delivers the treasure every single time.

The Complete Stage Is Set

Look at what we just assembled: a world made of states, actions that trigger transitions (sometimes steady, sometimes windswept), rewards scattered through the world, and a Patience knob deciding how far ahead the agent cares to look. Almost every reinforcement learning problem—from board games to walking robots—lives on this exact stage.

Key Takeaways

Coming up next: In the Slippery Bridge lab, you saw tile colors quietly adjust themselves whenever you dragged the wind slider. How does that glow actually spread from a distant treasure back to every corner of a maze? In Chapter 4, we'll watch value flow backward step by step.