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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started