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.
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
- (Find the number of years and days) program that prompts the user to enter the minutes (e.g., 1 billion), and displays the number of years and days for the
- What is a good free source to learn coding?
- What, if anything, is wrong with this code? student_score = int(input("Enter this student's score: ")) score = student_score + 5 print("With the 5-point curve,