/* house(Nationality,Color,Pet,Drink,Smoke) */

zebra(Houses) :-
    Houses = [house(norwegian,_,_,_,_), house(_,blue,_,_,_), house(_,_,_,milk,_), _, _],
    member(house(englishman,red,_,_,_), Houses),
    member(house(spanish,_,dog,_,_), Houses),
    member(house(_,green,_,coffee,_), Houses),
    member(house(ukranian,_,_,tea,_), Houses),
    rightof(house(_,white,_,_,_), house(_,green,_,_,_), Houses),
    member(house(_,_,snails,_,old_gold), Houses),
    member(house(_,yellow,_,_,kools), Houses),
    nextto(house(_,_,_,_,chesterfields), house(_,_,fox,_,_), Houses),
    nextto(house(_,_,_,_,kools), house(_,_,horse,_,_), Houses),
    member(house(_,_,_,orange_juice,lucky_strike), Houses),
    member(house(japanese,_,_,_,parliaments), Houses).
    % sort([A1,A2,A3,A4,A5], S), S = [zebra,dog,fox,horse,snails].

rightof(H1, H2, [H1,H2|_]).
rightof(H1, H2, [_,H1,H2|_]).
rightof(H1, H2, [_,_,H1,H2|_]).
rightof(H1, H2, [_,_,_,H1,H2]).

nextto(H1, H2, Houses) :- rightof(H1, H2, Houses).
nextto(H1, H2, Houses) :- rightof(H2, H1, Houses).
