Question
A mother with 2 daughters, a father with two sons, and a policeofficer with a prisoner want to cross a river using only a boatthat
A mother with 2 daughters, a father with two sons, and a policeofficer with a prisoner want to cross a river using only a boatthat can hold two people. None of the daughters can be left alonewith the father and neither of the sons can be left alone with thefather. However, the mother and father can cross the river. Theprisoner cannot be left alone with anyone without the cop present.However, the prisoner can be left alone if they are absolutelyalone. The police officer can travel with anyone. Only the father,the mother and the police officer can operate the boat
I know the solution to be as follows: You cross the river withthe police officer and the prisoner, leave the prisoner alone andreturn the police officer to the other side of the river. Next youcross the river using the police officer and one of the sons, youreturn the police officer with the prisoner and leave the son aloneon the other side of the river. Next you send the father with theother son and return the father, leaving both sons across theriver. Next you send the mother and the father and return themother, leaving the father and the sons across the river. Next yousend the police officer with the prisoner across the river andreturn the father, leaving the police officer, prisoner and twoboys across the river. You then send the mother and father acrossthe river and send the mother back, leaving everyone but the motherand daughters across the river. You then send the mother with oneof the daughters and return the police officer and the prisoner,leaving the father and his sons, the mother with one daughteeracross the river. You then send the police officer across the riverwith the remaining daughter. Finally you send the police officeracross the river and send him back with the prisoner.
How can I implement this using CLINGO programming?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started