Project Description
You are a farmer tasked with getting goats and wolves across a river for some reason. If the wolves ever outnumber the goat on either side of the river, the wolves will overpower and eat the goat. You have a boat, which can only take one or two animals in it at a time, and must have at least one animal in it. How do you move all the animals from one side of the river to the other?
There were initially 3 goat and 3 wolves; here, your agent should be able to solve the problem for an arbitrary number of initial goat and wolves. You may assume that the initial state of the problem will follow those rules (e.g. we won’t give you more wolves than goat to start). However, not every initial state will be solvable; there may be combinations of goat and wolves that cannot be solved.
You will return a list of moves that will solve the problem, or an empty list if the problem is unsolvable based on the initial set of Goat and Wolves. You will also submit a brief report describing your approach.
Starter Code
Here is your starter code: mini-project1.zip. The starter code contains two files: SemanticNetsAgent.py and main.py. You will write your agent in SemanticNetsAgent.py. You may test your agent by running main.py. You may add more initial test cases in main.py for to ensure the program works on arbitrary number of goats and wolves.
In SemanticNetsAgent.py, your solve() method will have two parameters: the number of goat and the number of wolves. We would call your agent with your agent.solve(3, 3). You may assume that the initial state is valid (there will not be more Wolves than Goat in the initial state).
Returning Your Solution
Your solve() method should return a list of moves that will result in the successful solving of the problem. These are only the moves your agent ultimately selected to be performed, not the entire web of possible moves. Each item in the list should be a 2-tuple where each value is an integer representing the number of goat (the first integer) or wolves (the second integer) to be moved; we assume the moves are alternating. So, if your first move is (1, 1), that means you’re moving one goat and one wolf to the right. If your second move is (0, 1), that means you’re moving one wolf to the left.
For example, one possible solution to the test case of 3 goat and 3 wolves would be:
[(1, 1), (1, 0), (0, 2), (0, 1), (2, 0), (1, 1), (2, 0), (0, 1), (0, 2), (0, 1), (0, 2)]
The result of running the moves in order should be (a) that all animals are successfully moved from left to right, and (b) that all intermediate states along the way are valid (wolves never outnumber goat without the boat present).
Requirements
You will return a list of moves that will solve the problem, or an empty list if the problem is unsolvable. Refer to the section on Returning Your Solution for detailed explanation.
Your agent should be able to solve the problem for an arbitrary number of initial goat and wolves. Refer to the Project Description for detailed explanation.
You will write your agent in SemanticNetsAgent.py. You may test your agent by running main.py.
You are required to test ALL test cases in main.py without errors.
Write up a short report describing your agent’s design and performance. Your report may be up to 4 pages, and should answer the following questions:
How does your agent work? How does it generate new states, and how does it test them?
How well does your agent perform? Does it struggle on any particular cases?
How efficient is your agent? How does its performance change as the number of animals rises?
Does your agent do anything particularly clever to try to arrive at an answer more efficiently?
How does your agent compare to a human? Does your agent solve the problem the same way you would?
You are encouraged but not required to include visuals and diagrams in your four page report. You may include code snippits if you think they are particularly novel, but please do not include the entirety of your code.
Get Free Quote!
401 Experts Online