Knowledge base I'm using:
connected(1,2).
connected(3,4).
connected(5,6).
connected(7,8).
connected(9,10).
connected(12,13).
connected(13,14).
connected(15,16).
connected(17,18).
connected(19,20).
connected(4,1).
connected(6,3).
connected(4,7).
connected(6,11).
connected(14,9).
connected(11,15).
connected(16,12).
connected(14,17).
connected(16,19).
The question I'm trying to solve:
Suppose that you add "connected(4,3)" immediately below the fact "connected(3,4)". Running the query ?- path(3,2) results in a a loop and does not terminate. Modify path/2 using an accumulator to store the points already visited, so that it never revisits the same point when calculating the path. Then run the query ?- path(3,2) again.
The trouble I'm having here is that I'm very new to Prolog, I've not actually used an accumulator before (as far as I'm aware) and as a result I'm unsure on how to proceed. If anyone could explain to me the steps I'd have to take that would be great.
Also, I'm seeing a lot of stuff with "/2" after it - any explanation as to what this means in general?
Cheers.