Approaches to AI 6

Water jug puzzle: An eight-liter jug is filled with water, you are required to divide it into 4 + 4 liters. You may use two empty jugs of size 5 and 3 liters for this purpose. There is no other way of measuring water except by the size of the jugs, i.e., one can either empty a jug into another or fill another jug to its brim

Model this puzzle as a state-space search problem. A state is represented by a tuple (A,B,C), where A is the amount of water in 8L jug, B is the amount of water in 5L jug and C is the amount of water in 3L jug.
The initial state is (8,0,0), if you transfer water from 8L jug to 5L jug we reach (3,5,0) state, and if you transfer the remaining water from 8L jug to 3L jug we reach (0,5,3) state. Now we can reverse these two transfers. The state-space expresses all valid states and their transitions. Build the state-space to answers the following questions.

0. Starting from (8,0,0), what is the least number of transfers required to measure 7 liter?

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *