When first confronted with this problem, I tried to solve it
by writing and running a Prolog program. That did, however, not
help me any further because this problem has lots of equivalences
inside, and I simply did not know how to deal with equivalences
using a Prolog implementation with depth-first search.
Disillusioned, I turned off my computer and solved it with pen
and paper, which took me about half an hour.
Situation:
There are five men. Each of these men lives in a house with a
certain color, has a certain nationality, prefers a certain
drink, has got a certain pet and smokes a certain brand of tobacco.
| Nationalities | House colors |
Drinks | Pets | Tobacco brands |
| British | blue | Beer | Bird | Dunnhill |
Danish | green | Coffee | Cat | Marlboro |
German | red | Milk | Dog | Pall Mall |
Norwegian | white | Tea | Fish | Rothmann's |
Swedish | yellow | Water | Horse | Winfield |
Constraints:
- The Briton lives in the red house.
- The Swede has a dog.
- The Dane loves tea.
- The green house is located on the left of the white one.
- The person who owns the green house drinks coffee.
- The person who smokes Pall Mall has got a bird.
- The man who lives in the middle house is a milk-drinker.
- The owner of the yellow house smokes Dunnhill.
- The Norwegian lives in the left-most house.
- The man who smokes Marlboro lives next to the one that has got a cat.
- The man who owns a horse lives next to the one that smokes Dunnhill.
- The man who smokes Winfield likes beer.
- The Norwegian lives next to the blue house.
- The German smokes Rothmann's.
- The person who smokes Marlboro has a neighbor who drinks water.
Question:
Who owns the fish?