Test a prolog program to simulate a mouse traversing a maze

Assignment Help Programming Languages
Reference no: EM131729617

Midterm Test - Logical programming

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:

948_figure.png

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(e,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(e,b).

Some mice do not reach the exit because they become weak with hunger after visiting more than 3 rooms. Add a predicate cheese/I that specifies 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 contains cheese, but if the mouse visits more than 3 rooms without eating cheese then that mouse must backtrack and try another path through the maze.

Reference no: EM131729617

Questions Cloud

What is the depth range of the deepest earthquake : About how many earthquakes have occurred in the Los Angeles area in the past 30 days? What is the depth range of the deepest earthquake?
Related to leading organizational change published : Prepare a report on a journal article (ANY ARTICLE) related to leading organizational change published during the period 2005-2017.
How the type of radio signals impact the security of network : Describe how the types of radio signals and structure of wireless and cellular networks impact the security of wireless networks.
Evaluate why are the ladies shunning coach : Evaluate 'Why are the ladies shunning Coach?'. What, in your opinion, are the conditions contributing to Coach's demise?
Test a prolog program to simulate a mouse traversing a maze : COMP 333 Midterm Test - Logical programming. Write, execute, and test a Prolog program to simulate a mouse traversing a maze
Challenges are managers of health-care organizations facing : What challenges are managers of health-care organizations facing?
Direct interactions refers : According to Graicunas, direct interactions refers to:
Find proportion that is left-handed in nationwide population : A convenience sample of n = 400 college students in two classes at the same university is used to estimate the proportion that is left-handed in the nationwide.
Use will yield to the business performance : Discuss how a time driven ABC cost system can be implemented in PepsiCo and the benefits that the use will yield to the business performance.

Reviews

len1729617

11/20/2017 1:23:45 AM

COMP 333 Midterm Test 2 (Take-home part). Total points = 50. Due before 10 p.m. in Canvas on Sunday, 19. Submit your solutions in one Word or pdf file. Be sure to include your name and page numbers on your submission.

Write a Review

Programming Languages Questions & Answers

  Constructors need to be declared for each class.

Hi, I need helping figuring out the following questions. I need to identify the following statements as either true or false. If an answer is true, I need to explain why and, where appropriate, provide an example. If the answer is false, I also ne..

  Create three exception classes named numberhighexception

create three exception classes named NumberHighException, NumberLowException, and NumberNegativeException. Both NumberHighException and NumberLowException should be directly subclassed from the Exception class, but NumberNegativeException should b..

  Explain the theory & concepts involved in the design of page

Discuss what makes an effective as well as a poorly designed web page, and be able to critically evaluate them

  A number type or boolean

In Java, a number type or Boolean (There are 8: long, short, float, char, int, boolean, byte, bit, double)

  What is a virtual function and what is its purpose

What is a virtual function? What is its purpose? What is the difference between a virtual and a pure virtual function? What is an abstract class, and what is its purpose?

  Write program that inputs integers from keyboard

Write a program that inputs 20 integers from the keyboard and stores them in an array called A. You are then To: Output the numbers in the original input order.

  Difference in systolic blood pressure among race categories

Verify if there is any difference in Systolic blood pressure among the Race categories and type of analysis is appropriate and why?

  Write program which prompts user to input integer

Write a C++ program which prompts user to input the integer and then ouputs both individual digits of number and the sum of the digits.

  Javascript for metric conversions

Write a javascript that will assist the user with metric conversions. Your program should allow the user to specify the names of the units as strings.

  Design getter and setter and constructor methods

User must have option to draw new shape at different location and keep the existing shape. Design all the getter and setter & constructor methods for each class.

  Write application to use random-number to create sentences

Write an application that uses random-number generation to create sentences. Use four arrays of strings called article, noun, verb and preposition.

  Write a function that accepts an array a as input and

write a function that accepts an array a as input and searches the contents of the array for elements in three

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