The following puzzle is said to be invented by Einstein. Supposedly, he also claimed that only 2% of the world’s population would be smart enough to solve it.
There are 5 houses in 5 different colors in a row. In each house lives a person with a different nationality. These 5 owners drink a certain drink, smoke a certain brand of cigar, and keep a certain pet. No owners have the same pet, smoke the same brand of cigar or drink the same drink.
The question is: WHO OWNS THE FISH?
HINTS:
- the Brit lives in the red house
- the Swede keeps dogs as pets
- the Dane drinks tea
- the green house is on the immediate left of the white house
- the green house owner drinks coffee
- the person who smokes Pall Mall rears birds
- the owner of the yellow house smokes Dunhill
- the man living in the house right in the center drinks milk
- the Norwegian lives in the first house
- the man who smokes blends lives next to the one who keeps cats
- the man who keeps horses lives next to the one who smokes Dunhill
- the owner who smokes Bluemaster drinks beer
- the German smokes prince
- the Norwegian lives next to the blue house
- the man who smokes blends has a neighbor who drinks water
Working out the solution with nothing more that a pen and some paper is certainly doable by, I suspect hope, a larger percentage of people than the 2 % mentioned above. But as an example of how to solve these kinds of logic puzzles using Prolog, I wrote this code.
hi
Thank you for solving.
Good Luck.