Die Harder
There is a 3-gallon jug and a 5-gallon jug next to a fountain with infinite water. Your goal is to fill the 5-gallon jug with exactly 4 gallons of water by filling, emptying, and pouring between the jugs.
Variables
Your spec should contain two variables:
- small — the number of gallons currently in the 3-gallon jug.
- big — the number of gallons currently in the 5-gallon jug.
Initial State
Both jugs initial start without any water.
Transitions
At each step any of the following can happen
- Fill the
smalljug to its capacity (3). - Fill the
bigjug to its capacity (5). - Empty the
smalljug. - Empty the
bigjug. - Pour from the
smalljug into thebigjug until thebigjug is full or thesmalljug is empty. - Pour from the
bigjug into thesmalljug until thesmalljug is full or thebigjug is empty.