Is anybody can make a python code to work out the famous Bridge crossing Riddle. Please refer to link in the description | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is anybody can make a python code to work out the famous Bridge crossing Riddle. Please refer to link in the description

Four 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 2 minutes, C in 5 minutes, and D in 8 minutes. When two people cross the bridge together, they must move at the slower person's pace. The question is, How they can cross it in 15 min or less. https://en.m.wikipedia.org/wiki/Bridge_and_torch_problem

7th Jun 2017, 5:53 PM
shekhar dwivedi
shekhar dwivedi - avatar
2 Answers
+ 1
Post your code, and we'll help with the parts you don't understand :)
9th Jun 2017, 7:57 AM
Bogdan Sass
Bogdan Sass - avatar
+ 1
Here is the code from me, I made it so that you can change variables and it will still find the optimal solution. https://code.sololearn.com/c20YWq0sO0ij/?ref=app
10th Jun 2017, 9:07 AM
Cika Nikola
Cika Nikola - avatar