Trial and error discovers effective actions by repeatedly probing an environment, observing rewards, and retaining actions or action sequences that produce better outcomes. section 11.1
A reinforcement-learning loop typically proceeds as follows:
- Observe the current state and choose an action, initially often at random. section 11.1 section 11.1.1
- Let the environment return a reward and a new state. section 11.1
- Accumulate experience until the agent solves the task or the episode ends. section 11.1
- Estimate action quality so later decisions increasingly favor successful behavior. section 11.1.1
Frozen Lake with Q-learning
A 4-by-4 Frozen Lake environment lets an agent move up, down, left, or right. Falling through a hole ends the episode with negative reward; reaching the bottom-right corner completes it. A Q-table records state-action values, while an epsilon-greedy policy explores randomly before increasingly selecting higher-valued actions. Training repeatedly resets the environment, chooses actions, updates Q-values, and stops each episode when it ends. section 11.1.1
Compare trial-and-error learning with other learning forms before examining its reinforcement-learning loop. section 11.1

