Question: Write a Prolog program that describes bus routes between cities. Use the predicate connect / 2 to describe the cities between which the bus runs,
Write a Prolog program that describes bus routes between cities. Use the predicate connect to describe the cities between which the bus runs, eg connectsaldusskrunda and the predicate connect which finds possible connections between two cities, including those that require a transfer. Note. The program may not include inverted routes, eg if you have connectsaldus skrunda and connectskrunda liepbar a ja then the predicate routesaldus liepbar a ja must find connections saldusskrundaliepbar a ja and print out the full route the traveler must have, but routeliepbar a ja saldus may not find the route. You need to make a logic that will not allow the traveler to visit each city more than one time
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
