0% found this document useful (0 votes)
5K views7 pages

Water Jug Problem Rules Guide

The document describes the rules for solving the water jug problem using two jugs that can hold 4 and 3 gallons respectively. There are 12 rules that define the steps to fill, empty, and pour water between the jugs with the goal of obtaining a specific water amount in one or both jugs.

Uploaded by

neha
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5K views7 pages

Water Jug Problem Rules Guide

The document describes the rules for solving the water jug problem using two jugs that can hold 4 and 3 gallons respectively. There are 12 rules that define the steps to fill, empty, and pour water between the jugs with the goal of obtaining a specific water amount in one or both jugs.

Uploaded by

neha
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Shaishav Agrawal

Water Jug Problem


Rules
1. (x,y)→(4,y) Fill the 4 gallon Jug
If x<4
2. (x,y)→(x,3) Fill the 3 gallon Jug
If y<3
3. (x,y)→(x-d,y) Pour some water from
4 gallon jug.
If x>0
Rules
4. (x,y)→(x,y-d) Pour some water from
3 gallon jug.
If y>0
5. (x,y)→(0,y) Empty the 4 gallon jug.
If x>0
6. (x,y)→(x,0) Empty the 3 gallon jug.
If y>0
Rules
7. (x,y)→(4,y-(4-x)) Pour water from
the 3 gallon jug into the 4 gallon jug
until the 4 gallon jug is full.
If x+y>=4 and y>0
8. (x,y)→(x-(3-y),3) Pour water from
the 4 gallon jug into the 3 gallon jug
until the 3 gallon jug is full.
If x+y>=3 and x>0
Rules
9. (x,y)→(x+y,0) Pour all water from
the 3 gallon jug into the 4 gallon jug.
If x+y<=4 and y>0
10. (x,y)→(0,x+y) Pour all water from
the 4 gallon jug into the 3 gallon jug.
If x+y<=3 and x>0
Rules
11. (0,2)→(2,0) Pour 2 gallons from the
3 gallon jug into the 4 gallon jug.
12. (2,y)→(0,y) Empty the 2 gallons in
the 4 gallon jug on the ground.
Solution

You might also like