With the following facts,
x(p1,d1,c,d,e,f),
y(d1,d2,i,j,k,l),
z(d2,d3,o,p,q,r),
Think of them as points, I would like to know how I can go from x to z, by inputting p1 and d3.
I have, for example:
write('Partida: '),nl,
read(Partida_it),
write('Destino: '),nl,
read(Destino_it),
viagem(Partida_it,Destino_it,C,D,E,F),nl,
write(Partida_it),write('<-->'),write(Destino_it),nl,
write('Tipo: '),write(C),nl,
write('Hora de partida: '),write(D),nl,
write('Hora de chegada: '),write(E),nl,
write('Preco: '),write(F),nl,
fail,
In case this trip already exists ^
viagem(Partida_it,B,C,D,_,P1),nl,
viagem(B,Destino_it,F,_,E,P2),nl,
P is P1+P2,
write(Partida_it),write('<-->'),write(Destino_it),nl,
write('Tipo: '),write(C),write('e'),write(F),nl,
write('Hora de partida: '),write(D),nl,
write('Hora de chegada: '),write(E),nl,
write('Preco: '),write(P),nl,
fail.
I've been stuck with this problem for a couple of hours now.