Write a prolog program to simulate a mouse traversing a maze

Assignment Help Programming Languages
Reference no: EM131734503

Assignment

i. Write, execute, and test a Prolog program to simulate a mouse traversing a maze.

Use a predicate d/2 to specify the doors between rooms of the maze, e.g., d(a,b) means that there is a door linking rooms a and b. Assume that the mouse always starts in the room named enter, and that the room named exit has the only door out of the maze, although room exit may also have doors leading to other rooms.

Show all solutions for the mouse running the maze in each test case.

Use at least the following 5 test cases:

(A) d(enter,b). d(b,c). d(b,e). d(d,e). d(c,d). d(e,f). d(e,exit).
(B) d(enter,e). d(b,c). d(b,e). d(d,e). d(c,d). d(e,f). d(f,exit).
(C) d(enter,e). d(b,c). d(d,e). d(c,d). d(e,f). d(g,e).
(D)d(enter,e). d(b,c). d(d,e). d(c,d). d(e,f). d(c,exit).
(E) d(enter,a). d(a,exit).

A picture of the maze defined in case (A) follows:

2020_Maze-Defined.jpg

ii.Revise your program from part (i) above as follows. Then run the same 5 test cases from part (i), as well as at least the following additional 5 test cases:

(F) d(enter,b). d(b,e). d(b,c). d(c,d). d(d,e). d(c,exit). cheese(c).
(G)d(enter,a). d(a,b). d(b,c). d(c,d). d(d,e). d(e,exit). cheese(a), cheese(d).
(H)d(enter,a), d(a,b). d(b,c). d(b,exit). d(a,exit). d(c,d).
(I) d(enter,e). d(e,c), d(d,e). d(c,d). d(e,f). d(f,exit). cheese(c).
(J) d(enter,a). d(a,b). d(b,c). cheese(b). d(b,exit). d(a,d). d(d,e). d(c,b).

Some mice do not reach the exit because they become weak with hunger after visiting more than 3 rooms. Add a predicate cheese/1 that specifics which rooms have food (i.e., cheese), e.g., cheese(d) is true if and only if room d contains cheese. Change your program so that a mouse eats some cheese at least once every 3 rooms traversed. In other words, the mouse eats a little bit of cheese in any room that contain!, cheese, but if the mouse visits more than 3 rooms without eating cheese then that mouse most backtrack and try another path through the maze.

Reference no: EM131734503

Questions Cloud

Discuss the goals of the research questions : Discuss the goals of the research questions. Do you expect both questions to remain open over the coming few years? Why?
Considering an energy management investment : The local IT company is considering an energy management investment which will save 3000kWh of electricity per year at $0.3/kWh. Maintenance
Provide the journal entry for recognizing interest expense : Provide the journal entry for recognizing interest expense and interest paid on June 30 and December 31,Year 1
Define data in computerized form is discoverable : Data in computerized form is discoverable even if paper "hard copies" of the information have been produced
Write a prolog program to simulate a mouse traversing a maze : Write, execute, and test a Prolog program to simulate a mouse traversing a maze. Use a predicate d/2 to specify the doors between rooms of the maze, e.g.
Calculate the present value : Given the following information, calculate the present value of the following bond that pays semi-annual coupons. Par value: $1,000. Coupon Rate: 8%.
Develop three or four qualitative evaluation questions : Discuss your perception on developing the same questions for all participants and the validity of the questions.
What was the return you received over the year : If you bought a stock for $75 and sold it for $85 after a year, you also received a dividend of $5 in that year. What was the RETURN you received over the year?
How much is the issuance price of the bond on january : Yummy Food Limited, whose fiscal-year ends on December 31, issued a 10-year, How much is the issuance price of the bond on January 1, Year 1

Reviews

Write a Review

Programming Languages Questions & Answers

  Design a grade average program by using raptor which will

design a grade average program using raptor that will produce the numerical grade average of test scores input by a

  Develop pseudo-code for program to retrieve bytes

Develop the pseudo-code for a program that will retrieve 2 bytes (NUM1 and NUM2) from memory, determine which is closest to the numeric value 50.

  Write program to prompt number of rooms in house

Write down the program which prompts for number of rooms in house. Use input, n, to declare array of rectangles dynamically. In loop, input dimensions for n rooms.

  Also assume the air behaves as an ideal gas with constant

consider the evaporator section of a window air conditioner note the evaporator may be considered as a shell and tube

  Designing system to handle donations of non-profit agency

You have been hired by worldwide non-profit agency to create a system to handle their donations.

  Write program to enter current value of car

Write a program that asks the user to enter the current value of a car. For a new car, it is the selling price of the car. The program should display the number of years it takes for the car's trade-in value to be below $1000.

  Pseudocode for linear search by using clrs3e style

Write pseudocode for linear search by using CLRS3e style used in, which scans through the sequence, looking for v.

  Determining smallest possible number people in parade

Group of people are arranging themselves for parade. Determine the smallest possible number people?

  Design implement test and debug a program with a jframe

design implement test and debug a program with a jframe that allows the user to enter a series of contacts names ages

  Template that computes and displays the absolute value

Create a program that uses this function template, passing in two arguments of type int, float, and double variable.

  Implement and test the functions

Programming Assignment - implement and test the four functions described below that use pointers and dynamic memory allocation and Rewrite the function so it uses pointers instead of reference parameters. When you test this function from the main pr..

  Write a program where you create a class called bankaccount

Write a program where you create a class called BankAccount. The BankAccount class should contain a String to store the customer name and a double to store the account balance.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd