You have five different jugs, without any marks at all, with capacities of 3, 4, 5, 6 and 7 litres. Initially, the
3,
5 and
7-jugs are completely filled with liquid (so we have 15 litres of the liquid; in the diagram below, an "x" stands for 1 litre) and the other two are empty. The jugs are arranged in the circular manner shown below, which can't be changed:
| |
+-+ +-+
| o o |
| o o |
+-----+
| | | |
+-+ +-+ +---+ +---+
| x | | x x x x |
| x x | | x x x |
+-----+ +---------+
| | | |
+--+ +--+ +--+ +--+
| x x x | | o o o |
| x x | | o o o |
+-------+ +-------+
The goal is to achieve 3 litres in each of the 5 jugs, only by pouring liquid from one jug into an
adjacent one. (That is, at any time, you can pour liquid from the 3-jug only into the 4-jug or to the 5-jug; or from the 7-jug only into the 4-jug or to the 6-jug, etc...)
If the program is allowed to run fully through, it finds 54 solutions with the minimum, 11, steps:
3 0 7 0 5 | 3 0 7 0 5 | 3 0 7 0 5 | 3 0 7 0 5 | 3 0 7 0 5 | 3 0 7 0 5
0 3 7 0 5 | 0 3 7 0 5 | 0 3 7 0 5 | 3 0 7 5 0 | 3 0 7 5 0 | 3 4 3 0 5
0 3 7 5 0 | 3 3 7 0 2 | 0 3 1 6 5 | 0 0 7 5 3 | 3 0 6 6 0 | 3 4 3 5 0
0 3 6 6 0 | 3 3 1 6 2 | 3 3 1 6 2 | 0 4 3 5 3 | 0 3 6 6 0 | 0 4 3 5 3
0 2 7 6 0 | 3 3 1 3 5 | 3 3 1 3 5 | 3 1 3 5 3 | 0 3 6 1 5 | 0 4 2 6 3
0 2 7 1 5 | 2 4 1 3 5 | 3 3 0 4 5 | 3 1 2 6 3 | 3 3 6 1 2 | 3 1 2 6 3
3 2 7 1 2 | 2 4 0 4 5 | 2 4 0 4 5 | 3 3 0 6 3 | 3 3 6 3 0 | 3 3 0 6 3
3 2 7 3 0 | 2 0 4 4 5 | 2 0 4 4 5 | 2 4 0 6 3 | 0 3 6 3 3 | 2 4 0 6 3
0 2 7 3 3 | 2 0 4 6 3 | 2 0 4 6 3 | 2 0 4 6 3 | 0 2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