Adding some code a wrote a while ago to solve the "water jugs" problem.