It tracks water usage, if you want to optimize a solution that way, but that's commented out right now. I suspect that the shortest path solution is always the least water used solution.I think you are wrong. I wrote my own solution (which I won't post, as several have now been posted) and found that for jugs with sizes 3 and 7, and target 11, there's a solution that requires 5 moves (fill Y, pour Y in X, pour Y in Z, fill Y, pour Y in Z), but that uses 14 water. There's a solution that requires just 11 water, but that requires 6 moves (fill Y, pour Y in X, pour Y in Z, pour X in Y, fill Y, pour Y in Z).
Of course, my program may be wrong, and I might have missed a 5 move solution that uses just 11 water.
In reply to Re^2: Challenge: N Jugs Problem
by JavaFan
in thread Challenge: N Jugs Problem
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |