This script solves game with depth-first search and width-first search.
This script solves game with depth-first search and breadth-first search.
This script was made to slove a question below.
You have pails each can have 16, 9, 7 liter.
Now 16L pail is filled with water. You have to divide these into 8L and 8L respectively.
And you know minimum number of steps are 15.
But you can’t throw water away, and fill up again. (This is not “Die Hard: With a Vengeance”!) The picture below is the answer.
The numbers below are average execution times(second) in my environment.