Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!