Advertisement
Sylv3rWolf

prolog5

Nov 18th, 2015
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.63 KB | None | 0 0
  1. select(X,[7,1,5,4],Z),select(Y,Z,_).
  2.  
  3.  select(X,[7,1,5,4],Y).
  4.  
  5. select(X,[7,1,5,4],_).
  6.  
  7.  select(5,[7,1,5,4],X).
  8.  
  9. selekcja3(X,Y,Z):-L=[1,2,3,4],select(X,L,L1),select(Y,L1,L2),select(Z,L2,_).
  10.  selekcja3(X,Y,Z).
  11.  
  12. selekcja3(X,Y,Z):-L=[1,2,3,4],select(X,L,_),select(Y,_,L),select(Z,L,_).
  13.  
  14. rywale(A,B,D,G,W):-
  15.     L=[1,2,3,4,5],
  16.     select(A,L,L1),A\=1,A\=5,
  17.     select(B,L1,L2),
  18.     select(D,L2,L3),D\=2,
  19.     select(G,L3,L4),
  20.     select(W,L4,_),W\=1,
  21.     G=:=D+2,
  22.     B>W.
  23.  
  24. rywale(A,B,D,G,W):-
  25.     L=[1,2,3,4,5],
  26.     select(A,L,L1),A\=1,A\=5,
  27.     select(B,L1,L2),
  28.     select(D,L2,L3),D\=2,
  29.     select(G,L3,L4),
  30.     select(W,L4,_),W\=1,
  31.     G=:=D+2,
  32.     B=:=W+1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement