- Water jugs problem: We have one 3 litre jug, one 5 litre jug
and an unlimited supply of water. The goal is to get exactly
one litre of water into either jug. Either jug can be emptied or
filled, or poured into the other.
- A state in this problem could be represented with just a pair
of numbers. The first representing the number of litres of water
in the 5 litre (large) jug, and the second representing the number
of litres of water in the 3 litre (small) jug.
- The initial state would typically be: (0,0) to represent
the fact that both jugs start off empty.
- The final state would similarly be represented as: (0,1).
- The operators for this problem could include:
- Fill the 5 litre jug to capacity from a water source
- Fill the 3 litre jug to capacity from a water source
- Empty the 5 litre jug into a drain
- Empty the 3 litre jug into a drain
- Pour from the 3 litre jug into 5 litre jug until capacity reached
- Pour from the 5 litre jug into 3 litre jug until capacity reached
|