Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROLOG PROGRAM : Write a Prolog program for Train Travel using recursion (NO ITERATIVE SOLUTIONS) given the below: --------------------------------------------------------------------------------- (1) write a prolog program with

PROLOG PROGRAM :

Write a Prolog program for Train Travel using recursion (NO ITERATIVE SOLUTIONS) given the below:

---------------------------------------------------------------------------------

(1) write a prolog program with the following knowledge base.

directTrain(union-station, san-bernardino).

directTrain(oxnard, union-station).

directTrain(burbank, lancaster).

directTrain(lancaster, union-station).

directTrain(san-bernardino, riverside).

directTrain(santa-ana, burbank).

directTrain(burbank, santa-ana).

directTrain(oceanside, santa-ana).

---------------------------------------------------------------------------------

(2) write a Prolog recursive predicate travelBetween that tells us when we can travel by train between two towns (not necesarily by a single direct trail).

---------------------------------------------------------------------------------

(3) what results do ou get when you test the program with the query (screenshot please): ?-travelBetween(oceanside, san-bernardino).

---------------------------------------------------------------------------------

(4) extend the program with a rule that adds directTrain between A and B whenever there is one from B to A

---------------------------------------------------------------------------------

(5) what results do you get when you test this query (screenshot please): ?-travelBetween(san-bernardino, oceanside).

---------------------------------------------------------------------------------

(6) what are some problems this program might run into?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions