subject

In this project, you will write a simple program in Prolog to solve the following puzzle: In a children's story, three foxes and three hens are traveling together. They come to a river they must cross. There is a boat, but it will hold no more than two of them at a time, so at least six trips in each direction will be required (one animal has to row the boat back each time). The problem is that the hens cannot trust the foxes; if in the process of crossing the river we ever end up with more foxes than hens on either shore, the foxes are likely to eat the hens. We need a series of moves (trips across the river in the boat) that will get the entire party across sately. Your main predicate should be a goal solve(P). It should instantiate P to be a list of configurations, each of which indicates the location of the animals and the boat. If you request additional solutions (by typing a semicolon) the interpreter should give you additional lists, as many as there are unique solutions. One simple, minimal way to represent a configuration is to give the number of foxes, hens, and boats on the near defy shore(LF, LH, LB), where 0 You can think of the state space of this problem as a graph in which nodes are configurations and edges represent feasible boat trips. It's a large graph, however, and you won't want (nor in fact are you permitted) to represent it explicitly in your Prolog database. From any given state, you'll need to figure out the set of possible neighbors to explore. You'll also want to keep track of where you have been, so you don't get stuck in a cycle. You may find it helpful to use the not operator. You may also want to use the cut to avoid unnecessary backtracking. You are not permitted to use assert, retract, or other database- modifying predicates. (For the record, you must compute your solutions. You are not allowed to figure them out by hand and simply write a program that prints them.)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 03:00
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
Answers: 3
question
Computers and Technology, 23.06.2019 07:00
What are three software programs for mobile computing?
Answers: 1
question
Computers and Technology, 24.06.2019 10:20
Multiple choice project create a program with two multiple choice questions. 1. users have two attempts only, show attempt number each time. hint: while loop with break control. (20%) 2. only one correct answer for each question, use switch case for each question. (20%) 3. show total score after the two questions are answered. hint: . (20%) 4. user have options to answer the two questions again if first attempt score is not 100%. hint: if statment. (20%) 5. use string method .toupper() to allow users to enter with lowercase or uppercase letters. (20%) 1. where is the capital of the state of florida? a. orlando b. tallahassee c. miami d. tampa b 2. where is walt disney world park located in florida? a. orlando b. tallahassee c. miami d. tampa a
Answers: 1
question
Computers and Technology, 25.06.2019 06:10
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game behind everything else d. in front of everything else select the best answer from the choices provided
Answers: 1
You know the right answer?
In this project, you will write a simple program in Prolog to solve the following puzzle: In a child...
Questions
question
Mathematics, 23.02.2021 09:10
question
Mathematics, 23.02.2021 09:10
question
Mathematics, 23.02.2021 09:10
question
Mathematics, 23.02.2021 09:10
Questions on the website: 13722360