View the step-by-step solution to:

Question

Objective:

will have experienced the entire problem-solving process through designing and implementing a

program to solve a relatively complex river-crossing puzzle. In particular, will learn 

·       How to model a river-crossing problem as a graph problem; 

·       How to analyze the state space and classify them into different kinds of states; 

·       How to apply a shortest-path algorithm to solve the problem; 

·       How to modularize the entire program into smaller functions with well-defined signatures; 

·       How to implement graph based on adjacency list using Python dictionary; 

·       How to implement each function using Python accurately and with clear documentation; and 

·       How to do quality report to describe each step of the problem-solving process.

A Red-Sea-Crossing Problem: 

Moses is bringing seven other people with him from Egypt to Israel which are separated by Red Sea. Besides Moses, there are Pharaoh and two families: (1) Ahab (husband), Jezebel (wife) and a servant and (2) Ananias (husband), Sapphira (wife) and a servant. Further details below: 

·       They ride on a boat that accommodates only two people traveling between Egypt and Israel. 

·       Only Moses, Pharaoh, Ahab, and Ananias can operate the boat. 

·       If Moses is not present, Pharaoh will beat up all others with him. 

·       If Ahab is absent from his wife and servant, Ananias will beat them up. 

·       If Ananias is absent from his wife and servant, Ahab will beat them up.

The problem is to bring them from Egypt to Israel without having anyone beaten up in a minimum number of trips. 

The Project: 

In this project will design and implement a program to solve this problem. Must apply and document the three-step process: data abstraction, algorithm design and coding. For the last step, must modularize the code by identifying the functions that need and their signatures. 

Some important notes: 

1.     Follow the exact format of the expected output except of the number of empty lines separating different parts of the outputs. The states should also be printed in a sorted order 

2.     Section A: According to the problem, the boat can be operated only by men. Therefore, a more subtle constraint is to have boat with at least one man. That is, the states that violate this constraint will be considered illegal. 

3.     Section B: The final graph must include the nodes that are part of at least one shortest path. Draw the graph in a separate page. To obtain this final graph, need to do another function to prune away the nodes that are not part of any shortest path. 

4.     Section C : just need to print any one of the solutions. 


Expected outputs from the program

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Python Programming tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors