Hi, I'm having trouble writing a prolog program which does the following:
Say I'm given a map of 3 different points; Point A, point B and point C. Point A is connected to point B and point B is connected to point C, if you want to travel from point A to point C, you cannot move there directly, you have to travel through point B.
I've wrote a program which does this, but I'm unsure how I can implement some form of count variable which counts the number of 'movements'. For example, a journey from point A to point C would take two movements; point a to b, then point b to c.
/*--------------
connections between points
--------------*/
link(a,b).
link(b,c).
/*--------------
logic carried out to connect the movements.
--------------*/
movesto(A,B):- link(A,B).
movesto(A,B):- link(A,C), link(C,B).
/*-----------
layout of count arguement
--------------*/
count(A,B,N):-
Thanks in advance.