Watchful11

Untitled

Jun 1st, 2014
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. select([A|As],S):- select(A,S,S1),select(As,S1).
  2. select([],_).
  3.  
  4. right_of(A,B,C):- append(_,C,[A,B|_]).
  5. next_to(A,B,C):- right_of(A,B,C) ; right_of(B,A,C).
  6.  
  7. zebra(Owns, HS):- %// house: color,nation,pet,drink,drives
  8. HS = [ h(_,norwegian,_,_,_), _, h(_,_,_,milk,_), _, _],
  9. select([ h(red,brit,_,_,_), h(_,spainiard,dog,_,_),
  10. h(_,ukranian,_,tea,_), h(_,japanese,_,_,honda)], HS),
  11. select([ h(_,_,horse,_,saab), h(yellow,_,_,_,saab),
  12. h(_,_,_,juice,ford), h(green,_,_,coffee,_),
  13. h(_,_,snails,_,chevy)], HS),
  14. right_of( h(green,_,_,_,_), h(ivory,_,_,_,_), HS),
  15. next_to( h(_,_,_,_,bmw), h(_,_,fox,_,_), HS),
  16. next_to( h(blue,_,_,_,_), h(_,norwegian,_, _,_), HS),
  17. member( h(_,Owns,zebra,_,_), HS).
Advertisement
Add Comment
Please, Sign In to add comment