title: find path in prolog
body: <p>HI,I HAVE THESE DATA</p>
  
  <pre><code>Quote:
  
  flight(Place1,Place2,departure time,Arrival time,flight code,Day)
  flight(paris,milano,6,8,ba4733,mo).
  flight(milano,london,9,10,ba4733,mo).
  flight(london,athens,10,15,ba4733,mo).
  flight(milano,paris,10,15,ba4733,mo).
  </code></pre>
  
  <p>i want to find all  paths between 2 places for example</p>
  
  <pre><code>?- route(paris,athens,mo,A).
  
  A = [flight(paris,milano,ba4733,8), flight(milano,london,ba4733,10), flight(london,athens,ba4822,15)] ;
  </code></pre>
  
  <p>also to flight from place1 to place2 needs Day1=Day2 and Arrival time&lt;=departure time</p>
  
  <p>I have done these but my program stacks really bad:</p>
  
  <pre><code>apeuthias_ptisi(P1,P2):-ptisi(P1,P2,_,_,_,_).
  flight(P1,P2,COD,AF):-ptisi(P1,P2,_,AF,COD,_).
  
  
  antapokrisi(P1,Y,P1):-!.
  antapokrisi(P1,Y,P2):-ptisi(P1,Y,AN1,AF1,COD1,DAY1),
  ptisi(Y,P2,AN2,AF2,COD2,DAY2), AF1=&lt;AN2, DAY1==DAY2.
  
  
  path(X,Y,D,L2):-c2(X,Y,[],D,L),reverse(L,L2).
  
  c2(X,X,L,D,L):-!.
  c2(X,Y,L,D,L2):-antapokrisi(X,Z,P2),ptisi(X,Z,AN,AF,COD,D),not(member(Z,L)),c2(Z,Y,[flight(X,Z,COD,AF)|L],D,L2).
  
  
  
  route(P1,P1,D,R):-!.
  route(P1,P2,D,R2):-setof(R,path(P1,P2,D,R),R2).
  </code></pre>
  
  <p>Can anyone help me?</p>