Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

Appraisal process and timing

Answered: 1 week ago

Question

How to communicate positive and negative feedback

Answered: 1 week ago

Question

Performance criteria and job standards that should be considered

Answered: 1 week ago