Question: Prolog 4. If we had a one-way road links 6 towns. (i.e. town1----->-----town2---->----town3---->----town4--->----town5---->---town6 ) Finish writing the program that can work out if you can
Prolog
4. If we had a one-way road links 6 towns. (i.e. town1----->-----town2---->----town3---->----town4--->----town5---->---town6 )
Finish writing the program that can work out if you can travel on that road and can_get from A to B.
connected(town1,town2).
connected(town2,town3).
connected(town3,town4).
connected(town4,town5).
connected(town5,town6).
can_get(X,Y) :- connected(X,Y).
can_get(X,Y) :- connected(X,Z), can_get( _____ , _____ ).
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
