Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select([A|As],S):- select(A,S,S1),select(As,S1).
- select([],_).
- right_of(A,B,C):- append(_,C,[A,B|_]).
- next_to(A,B,C):- right_of(A,B,C) ; right_of(B,A,C).
- zebra(Owns, HS):- %// house: color,nation,pet,drink,drives
- HS = [ h(_,norwegian,_,_,_), _, h(_,_,_,milk,_), _, _],
- select([ h(red,brit,_,_,_), h(_,spainiard,dog,_,_),
- h(_,ukranian,_,tea,_), h(_,japanese,_,_,honda)], HS),
- select([ h(_,_,horse,_,saab), h(yellow,_,_,_,saab),
- h(_,_,_,juice,ford), h(green,_,_,coffee,_),
- h(_,_,snails,_,chevy)], HS),
- right_of( h(green,_,_,_,_), h(ivory,_,_,_,_), HS),
- next_to( h(_,_,_,_,bmw), h(_,_,fox,_,_), HS),
- next_to( h(blue,_,_,_,_), h(_,norwegian,_, _,_), HS),
- member( h(_,Owns,zebra,_,_), HS).
Advertisement
Add Comment
Please, Sign In to add comment