|
Indiana Jones Problem
The problem is the following: Indiana Jones, Jane, Wounded, and Fat are
coming back from an exploration in the rain forest. Unfortunately, the cannibals
are after them. They reach a point where they need to cross a rope-bridge.
Indiana evaluates that the cannibals will reach the bridge in 17 minutes.
If they have all crossed the bridge at that point, they'll just have to
cut the ropes and they will be free. If not, the cannibals will either cut
the rope and kill the people still on the bridge or have a good meal. Now
it is pretty dark in the rain forest, and they need a lamp when crossing
the bridge. Whatsmore, the latter is not in too good a state, and they can
only cross it two at a time. Indiana Jones, a well trained explorer, needs
only 1 minute to cross the bridge. Jane, getting accustomed to running with
Indiana, needs 2, Wounded 10 and Fat 5. Will they make it?
Download and "unzip" the specification. Open the Indy.package
file with CoopnTools. Open the specification IndyProblem. In "Tools"
menu select "Rebuild Prototype", wait for the rebuild, check if the rebuild
was successful (check Display Panel, you must see both "Prototype Generator:
Generation Succeed. " and "Prototype Generator: compilation done.") .
Finally, select "Interpret Prototype" from the same menu. The interpretor
tool will appear.
The way the interpretor works is the following: You select the methods
to invoke in the "Synchronization" field, and then press the "Interpret"
button to execute them. The methods name then appear in the text box in
either black (if the method committs), or red (if it fails).
The Indiana Jones Problem prototype interpretor allows us to call five
methods (commands): initTime, with a natural number as parameter,
allows the user to enter the time limit of the problem. traverser1
tries to make one protagonist (undeterministically) cross the bridge from
left to right. traverser2 tries to make two protagonists (undeterministically)
cross the bridge from left to right. traverserretour tries to make
one person cross the bridge from right to left. And, finally, traversertoutlemonde
tries to make n persons cross the bridge (n a natural between 0 and 4
that the user must give), by trying out sequences of calls of the previous
methods. The spec does not implement a traverserretour2 method
which tries to make two persons cross the bridge from right to left, as
such an action would trivially only be a waste of time. |