Reference no: EM13700775
Crossing a Canyon on a Cable Bridge.
Five friends must cross a canyon at night over a cable bridge. The primitive bridge is not very strong and only two people can cross at a time. They have only one lamp to see where they step. Because of this, one of the friends must return the lamp to the starting side for the others to cross.
Furthermore, the friends are not able to cross at the same speed. Thorin is able to cross in one minute, Fili in 3 minutes, Nori in 6 minutes, Bofur in 8 minutes and Balin in 12 minutes. When two friends cross together, they can only cross at the speed of the slower of the two.
They must make the crossing in less than 30 minutes.
Do not forget to count the time to go and return. For example, Fili crossing with Nori takes 6 minutes, and then Filli returning takes another 3 minutes and then Filli crossing with Thorin takes another 3 minutes, etc.
Construct a Prolog program using in-depth research to find a solution to this problem. It must compile with no errors and follow the directions.