Advertisement
Guest User

Untitled

a guest
Nov 29th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 1.42 KB | None | 0 0
  1. onstreet(X,s(X,_,_,_,_)).
  2. onstreet(X,s(_,X,_,_,_)).
  3. onstreet(X,s(_,_,X,_,_)).
  4. onstreet(X,s(_,_,_,X,_)).
  5. onstreet(X,s(_,_,_,_,X)).
  6.  
  7.  
  8. firstleft(X,s(X,_,_,_,_)).
  9. middlehouse(X,s(_,_,X,_,_)).
  10.  
  11. onleft(X,Y,s(X,Y,_,_,_)).
  12. onleft(X,Y,s(_,X,Y,_,_)).
  13. onleft(X,Y,s(_,_,X,Y,_)).
  14. onleft(X,Y,s(_,_,_,X,Y)).
  15.  
  16. onright(X,Y,s(Y,X,_,_,_)).
  17. onright(X,Y,s(_,Y,X,_,_)).
  18. onright(X,Y,s(_,_,Y,X,_)).
  19. onright(X,Y,s(_,_,_,Y,X)).
  20.  
  21. nextto(X,Y,S):-onleft(X,Y,S);onright(X,Y,S).
  22.  
  23. clue1(S):-onstreet(house(red,englishman,_,_,_),S).
  24. clue2(S):-onstreet(house(_,spaniard,_,dog,_),S).
  25. clue3(S):-onstreet(house(green,_,coffee,_,_),S).
  26. clue4(S):-onstreet(house(_,ukrainian,tea,_,_),S).
  27. clue5(S):-onright(house(green,_,_,_,_),house(ivory,_,_,_,_),S).
  28. clue6(S):-onstreet(house(_,_,_,snails,tennis),S).
  29. clue7(S):-onstreet(house(yellow,_,_,_,chess),S).
  30. clue8(S):-middlehouse(house(_,_,milk,_,_),S).
  31. clue9(S):-firstleft(house(_,norwegian,_,_,_),S).
  32. clue10(S):-nextto(house(_,_,_,_,rugby),house(_,_,_,fox,_),S).
  33. clue11(S):-nextto(house(_,_,_,_,chess),house(_,_,_,horse,_),S).
  34. clue12(S):-onstreet(house(_,_,orangejuice,volleyball),S).
  35. clue13(S):-onstreet(house(_,japanese,_,go),S).
  36. clue14(S):-nextto(house(_,norwegian,_,_,_),house(blue,_,_,_,_),S).
  37. clue15(S):-nextto(house(_,_,tea,_,_),house(_,_,milo,_,_),S).
  38.  
  39. clue(S):-clue1(S),clue2(S),clue3(S),clue4(S),clue5(S),clue6(S),clue7(S),clue8(S),clue9(S),clue10(S),clue11(S),clue12(S),clue13(S),clue14(S),clue15(S).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement