You are given a 3 liter gas can and a 5 liter gas can, which you can fill from a pump.
You need to use them to put exactly 4 liters of fuel in the tank of you motorbike. If you put less than 4 liters it won't be enough to cross the desert, and if you put more than 4 liters the bike will be too heavy, and you will sink in the desert sand.
You cannot reach the gas pump with your bike, so you have to get the right amount of fuel in the gas cans and walk.
[[Fill 3 liter can]]
[[Fill 5 liter can]]
(set: $canThree to 0)
(set: $canFive to 0)(set: $canThree to 3)
The five liter can now contains $canFive liters of fuel.
The three liter can now contains $canThree liters of fuel.
[[Pour into 3 liter can]]
[[Pour into 5 liter can]]
[[Fill 5 liter can]]
[[Fill 3 liter can]]
[[Empty 3 liter can]]
[[Empty 5 liter can]]
(if: $canFive is 4)[(go-to: "WIN")]
(link: "Restart")[(reload:)](set: $canFive to 5)
The five liter can now contains $canFive liters of fuel.
The three liter can now contains $canThree liters of fuel.
[[Pour into 3 liter can]]
[[Pour into 5 liter can]]
[[Fill 5 liter can]]
[[Fill 3 liter can]]
[[Empty 3 liter can]]
[[Empty 5 liter can]]
(if: $canFive is 4)[(go-to: "WIN")]
(link: "Restart")[(reload:)](set: $tempFive to $canFive)
(set: $tempThree to $canThree)
(set: $canFive += $canThree)
(if: $canFive > 5)[(set: $canFive to 5)]
(set: $canThree -= (5-$tempFive))
(if: $canThree < 0)[(set: $canThree to 0)]
The five liter can now contains $canFive liters of fuel.
The three liter can now contains $canThree liters of fuel.
[[Pour into 3 liter can]]
[[Pour into 5 liter can]]
[[Fill 5 liter can]]
[[Fill 3 liter can]]
[[Empty 3 liter can]]
[[Empty 5 liter can]]
(if: $canFive is 4)[(go-to: "WIN")]
(link: "Restart")[(reload:)](set: $canThree to 0)
The five liter can now contains $canFive liters of fuel.
The three liter can now contains $canThree liters of fuel.
[[Pour into 3 liter can]]
[[Pour into 5 liter can]]
[[Fill 5 liter can]]
[[Fill 3 liter can]]
[[Empty 3 liter can]]
[[Empty 5 liter can]]
(if: $canFive is 4)[(go-to: "WIN")]
(link: "Restart")[(reload:)](set: $tempFive to $canFive)
(set: $tempThree to $canThree)
(set: $canThree += $canFive)
(if: $canThree > 3)[(set: $canThree to 3)]
(set: $canFive -= (3-$tempThree))
(if: $canFive < 0)[(set: $canFive to 0)]
The five liter can now contains $canFive liters of fuel.
The three liter can now contains $canThree liters of fuel.
[[Pour into 3 liter can]]
[[Pour into 5 liter can]]
[[Fill 5 liter can]]
[[Fill 3 liter can]]
[[Empty 3 liter can]]
[[Empty 5 liter can]]
(if: $canFive is 4)[(go-to: "WIN")]
(link: "Restart")[(reload:)](set: $canFive to 0)
The five liter can now contains $canFive liters of fuel.
The three liter can now contains $canThree liters of fuel.
[[Pour into 3 liter can]]
[[Pour into 5 liter can]]
[[Fill 5 liter can]]
[[Fill 3 liter can]]
[[Empty 3 liter can]]
[[Empty 5 liter can]]
(if: $canFive is 4)[(go-to: "WIN")]
(link: "Restart")[(reload:)]Congrats, you won! You can ride your bike through the desert and reach safety.
(link: "Restart")[(reload:)]