level 9
We are given the following facts of travel information. Write a Prolog program that can answer the question like : Is it possible to travel from Valmont to Raglan using car, train, plane or their combination? i.e., input the question “travel(Valmont,raglan).” and the system should be able to output either “true” or “false”.
byCar(auckland,hamilton).
byCar(hamilton,raglan).
byCar(valmont,saarbruecken).
byCar(valmont,metz).
byTrain(metz,frankfurt).
byTrain(saarbruecken,frankfurt).
byTrain(metz,paris).
byTrain(saarbruecken,paris).
byPlane(frankfurt,bangkok).
byPlane(frankfurt,singapore).
byPlane(paris,losAngeles).
byPlane(bangkok,auckland).
byPlane(losAngeles,auckland).
2020年07月17日 03点07分