Question: The program used is Visual Studio Code. The lines of code need to be written in recursive. Help? the language used is prolog. 7340/Prolog/ 2-

The program used is Visual Studio Code. The lines of code need to be written in recursive. Help?The program used is Visual Studio Code. The lines of code need

the language used is prolog.

7340/Prolog/ 2- pwd. $ /Users/ Documents/ true. 7- consult('assignmento.pl"). true. 7- travelBetween(braintree, canton). true. 7- travelBetween(canton, braintree). true. 7- travelBetween(avon, milton). true. ?- travelBetween(milton, avon). true. 2-0 (10 points) We have the following knowledge base: That is, this knowledge base holds facts about towns it is possible to travel between by taking a direct train. But of course, we can travel further by 'chaining together' direct train journeys. Write a recursive predicate travelBetween/2 that tells us when we can travel by train between two towns. direct Train(avon, braintree). direct Train(quincy, avon). directTrain(newton, boston). direct Train(boston, avon). direct Train(braintree,milton). direct Train(westwood, newton). direct Train(canton, Westwood). For example, when given the query o travelBetween(canton, braintree). It should reply true. Whenever it is possible to take a direct train from A to B, it is also possible to take a direct train from B to A. For example, below query should return true, o travelBetween(braintree, canton)

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!