Dumb Artificial Intelligence Experimental Code
A Water Jug Problem: You are given two jugs, a 4-gallon one and a 3-gallon one, a pump which has unlimited water which you can use to fill the jug, and the ground on which water may be poured. Neither jug has any measuring markings on it. How can you get exactly 2 gallons of water in the 4-gallon jug?
State Representation and Initial State – we will represent a state of the problem as a tuple (x, y) where x represents the amount of water in the 4-gallon jug and y represents the amount of water in the 3-gallon jug. Note 0 ≤ x ≤ 4, and 0 ≤ y ≤ 3. Our initial state: (0,0) Goal Predicate – state = (2,y) where 0 ≤ y ≤ 3.
- Fill 4-gal jug x<4
- Fill 3-gal jug y<3
- Empty 4-gal jug on ground x>0
- Empty 3-gal jug on ground y>0
- Pour water from 3-gal jug to fill 4-gal jug 0<x+y≥4andy>0
- Pour water from 4-gal jug to fill 3-gal-jug 0<x+y≥3andx>0
- Pour all of water from 3-gal jug into 4-gal jug 0<x+y≤4andy≥0
- Pour all of water from 4-gal jug into 3-gal jug 0<x+y≤3andx≥0
- AO* Algorithm (Not Done)
- Block World Problem (Not Done)