Aku pergi depan jawab weh. Korang try arr if pandai! huehue..
1. Water Jug Problem
- You have a 4-gallon and 3-gallon water jug
- You have a faucet with an unlimited amount of water
- You need to exactly 2-gallon in 4-gallon jug
- x: Content of 4-gallon
- y: Content of 3-gallon
3. Initial state (0,0)
4. Goal state (2,n)
- Fill 3-gallon form faucet, fill 4-gallon form faucet
- Fill 3-gallon from 4-gallon, Fill 4-gallon from 3-gallon
- Empty 3-gallon into 4-gallon, Empty 4-gallon into 3-gallon
- Dump 3-gallon into drain, Dump 4-gallon into drain
p/s : Let's try people, you should try to give step by step solution so that by the end of the day you should have jug x with 2 gallon and jug y with any number, n. Note that you do not have any measurement tools!