Reference no: EM132211513
Question :
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(oceanside, santa-ana).
This knowledge base holds facts about towns you can travel between by taking a direct train, e.g., from union station to san bernardino.
Write a Prolog recursive predicate travelBetween that tells us when we can travel by train between two towns (not necessarily by a single direct train).