The bridge and torch problem (also known as The Midnight Train and Dangerous crossing) is a logic puzzle that deals with four people, a bridge and a torch. It is one of the category of river crossing puzzles, where a number of objects must move across a river, with some constraints.
Six people come to a river in the night. There is a narrow bridge, but it can only hold two people at a time. They have one torch and, because it's night, the torch has to be used when crossing the bridge. Person A can cross the bridge in 1 minute, B in 3 minutes, C in 4 minutes, and D in 6 minutes. Person E need 8 minutes, and Person F need 9 minutes. When two people cross the bridge together, they must move at the slower person's pace.
The question is, can they all get across the bridge if the torch lasts only 15 minutes?
python bridge_puzzle.py