Posted By: vik () on 'English'
Title: Re: Quiz
Date: Wed Apr 14 10:05:36 1999
> Below is a quiz written by Albert Einstein. He said 98% of the people in the
>
> world cannot solve the quiz. Are you among the 2%? Enjoy and pass along to a
>
> friend or coworker.
> FACTS:
> 1. There are 5 houses (in a row) in 5 different colours.
> 2. In each house lives a person with a different nationality.
> 3. These 5 owners drink a certain beverage, smoke a certain brand of
> cigar and keep a certain pet.
> 4. No owners have the same pet, smoke the same brand of cigar, or
> drink the same drink.
> HINTS:
> 1. The Brit lives in a red house.
> 2. The Swede keeps dogs as pets.3. The Dane drinks tea.
> 4. The green house is on the immediate left of the white house.
> 5. The green house owner drinks coffee.
> 6. The person who smokes Pall Mall cigars rears birds.
> 7. The owner of the yellow house smokes Dunhill cigars.
> 8. The man living in the house right in the center drinks milk.
> 9. The Norwegian lives in the first house.
> 10. The man who smokes Blend cigars lives next to the cat owner.
> 11. The man who keeps horses lives next to the man who smokes Dunhill.
> 12. The man who smokes Blue Master cigars drinks beer.
> 13. The German smokes Prince cigars.
> 14. The Norwegian lives next to the blue house.
> 15. The man who smokes Blend cigars has a neighbor who drinks water.
>
> The QUESTION IS .... who has a fish as a pet?Let me know if you solve it!
>
>
> ** Soy un hombre muy honrado, que me gusta lo mejor... **
> ...vlastne ani moc ne.
>
Hi, my solution is programmed in Prolow SWI 2.9.1 :-))
---
solve(Solution) :-
Solution = [ house( _, _, _, _, _),
house( _, _, _, _, _),
house( _, _, _, _, _),
house( _, _, _, _, _),
house( _, _, _, _, _) ] ,
member( house( red, brit, _, _, _), Solution),
member( house( _, swede, dogs, _, _), Solution),
member( house( _, dane, _, tea, _), Solution),
left_of( house( green,_,_,_,_), house( white,_,_,_,_), Solution)
member( house( green, _, _, coffee, _), Solution),
member( house( _, _, birds, _, pall_mall), Solution),
member( house( yellow, _, _, _, dunhill), Solution),
Solution = [_, _, house( _, _, _, milk, _), _,_],
Solution = [house(_, norwegian, _, _, _)|_],
next_to( house( _,_,_,_,blend), house( _,_,cat,_,_), Solution),
next_to( house( _,_,_,_,dunhill), house( _,_,horses,_,_), Solution),
member( house( _, _, _, beer, blue_master), Solution),
member( house( _, german, _, _, prince), Solution),
next_to( house( _,norwegian,_,_,_), house( blue,_,_,_,_), Solution),
next_to( house(_, _, _, _, blend), house( _, _, _, water, _), Solution),
member(house(_, _, fish, _, _), Solution).
left_of(A, B, [A, B | _]).
left_of(A, B, [_ | Y]) :- left_of(A, B, Y).
next_to(A, B, [A, B | _]).
next_to(A, B, [B, A | _]).
next_to(A, B, [_| Y]) :- next_to(A, B, Y).
member(X, [X|_]).
member(X, [_|B]) :- member(X, B).
?- solve(_Solution), member(house(_, Who, fish, _, _), _Solution).
---
Who = german.