Water Jars: verify a route and understand what makes it shortest
Trace a five-and-eight teaching configuration to six units, then distinguish checking one successful route from ruling out all shorter ones.
Worked examples use the Standard board unless a different size is stated. Hard and Expert may change the board dimensions or amount of information to track. Teaching positions are explained separately from the playable board.
State the configuration before the claim
A Water Jars route is meaningful only with fixed capacities, a target and a starting state. Use a separate teaching configuration: A holds at most five units, B holds at most eight, the target is six units in either jar, and both start empty. It illustrates the same action rules as the game; it is not a promise that this exact configuration belongs to the currently selected challenge bank.
Write states as (amount in A, amount in B). A fill reaches capacity, an empty action drains a jar, and a pour transfers as much as possible until its source empties or its destination fills. There is no button for transferring a chosen partial amount. These constraints determine the next state exactly, which lets us verify the route without estimating the height of an animated water surface.
Check every state in the proposed route
Fill B, then pour B into A. A fills with five units and B retains three. Empty A and transfer those remaining three units into it. Now A has room for two more units. Filling B again and pouring into A transfers exactly that two, leaving six in B. The target is reached even though A also contains water; the other jar does not have to be empty.
The table includes the empty starting state so each transition has a clear input. For the final pour, min(source amount, destination space) is min(8, 5 − 3) = 2. Subtract two from B and add two to A to obtain (5,6). This calculation checks both capacity conservation during the pour and the location of the target.
| Action | A afterward | B afterward |
|---|---|---|
| Start | 0 | 0 |
| 1. Fill B | 0 | 8 |
| 2. Pour B into A | 5 | 3 |
| 3. Empty A | 0 | 3 |
| 4. Pour B into A | 3 | 0 |
| 5. Fill B | 3 | 8 |
| 6. Pour B into A | 5 | 6 |
A successful route gives an upper bound
The six-action sequence proves that the teaching target can be reached in at most six accepted actions. By itself, it does not prove that five actions are impossible. That distinction matters whenever an explanation uses the word shortest. Finding one route and noticing that it feels efficient is not enough to establish a minimum.
For this small configuration, shortest-path search supplies the missing check. Begin with (0,0), explore every changed state reachable in one legal action, then every new state reachable in two, and continue layer by layer. Try all six actions at each state: fill either jar, empty either jar, or pour in either direction. The table lists all newly discovered states at each layer through six. No earlier layer contains a six in either coordinate, so no route of five or fewer accepted actions reaches the target.
| Minimum actions to reach state | New states (A, B) |
|---|---|
| 0 | (0, 0) |
| 1 | (5, 0); (0, 8) |
| 2 | (5, 8); (0, 5); (5, 3) |
| 3 | (5, 5); (0, 3) |
| 4 | (2, 8); (3, 0) |
| 5 | (2, 0); (3, 8) |
| 6 | (0, 2); (5, 6) |
Why repeated states can be skipped
If a state has already been reached in fewer actions, reaching the identical ordered pair later cannot create a new kind of continuation. Capacities and target have not changed, and every next action depends only on the pair. Keep the earlier visit and discard the later duplicate when searching for a shortest route. This is a claim about finding a minimum, not a ban on a player revisiting states while experimenting.
The capacity bounds allow at most 6 × 9 = 54 integer pairs, counting amounts zero through five in A and zero through eight in B. That is a bound on the possible state space, not a claim that all 54 are reachable. The search need only inspect reachable states. An action that leaves the amounts unchanged, such as emptying an already empty jar, creates no new state and adds no accepted move in the game.
Use the benchmark to inspect your decisions
When your route is longer than the displayed benchmark, look for the first state where you chose a different measurement. Ask what remainder the chosen pour was meant to create. An extra fill or empty can discard a useful remainder, forcing you to construct it again later. A longer valid route is still a solution; it simply demonstrates a different sequence.
Undo returns to the previous accepted state, including the earlier current-route move count. Restart empties the same configuration. New puzzle can change capacities or target, so a memorized six-action sequence may no longer apply. Transfer the verification method instead: name the state, compute the exact transfer, and distinguish a route you have checked from a minimum you have separately established.
An original guide for this site's implementation. Found an unclear step? Let us know. How we prepare and correct our guides.