This is straying off topic, but ...
From the output of this program, I don't think the solution is correct. Here are the facts stated by the program:
1) The Englishman lives in the red house.
2) The Swede keeps dogs as pets.
3) The Dane drinks tea.
4) The green house is on the left of the white house.
5) The green house owner drinks coffee.
6) The person who smokes Pall Mall rears birds.
7) The owner of the yellow house smokes Dunhill.
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 Blends lives next to the one who keeps cats.
11) The man who keeps horses lives next to the one who smokes Dunhill.
12) The owner who smokes Bluemaster drinks beer.
13) The German smokes Prince.
14) The Norwegian lives next to the blue house.
And here is the solution provided:
HOUSE | Nationality Color Pet Drink Smokes
--------------------------------------------------------------------
1 |norwegian yellow cats water dunhill
2 |dane blue horses COFFEE blends
3 |englishman red birds TEA pall-mall
4 |german green fish MILK prince
5 |swede white dogs beer bluemaster
However,
Fact 3 states that the Dane drinks tea - the solution claims it's coffee.
Fact 5 states that the Green house owner drinks coffee - the solution puts the coffee drinker in a blue house.
Fact 8 states that the center house owner drinks milk - the solution has him drinking tea.
So the solution should be:
HOUSE | Nationality Color Pet Drink Smokes
--------------------------------------------------------------------
1 |norwegian yellow cats water dunhill
2 |dane blue horses TEA blends
3 |englishman red birds MILK pall-mall
4 |german green fish COFFEE prince
5 |swede white dogs beer bluemaster
Clearly the drinks are getting mixed up someplace; the bug fix for this is left as an exercise for the reader. :)
-Bryan
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 11, 2003 9:24 AM
To: [EMAIL PROTECTED]
Subject: JESS: Einstein's Riddle in Jess
Hi David.
Here is a Jess solution to Einstein's Riddle as presented in your E-mail. The
approach to this problem and the implementation is taken directly from the
zebra.clp example supplied by the Jess distribution (which is taken, in turn,
directly from the Giarratano and Riley's "Expert Systems: Principles and
Programming").
Regards,
Win Carus
> Dear Jessers,
>
> I am a newbie to Jess. I would like to solve the following riddle using
> Jess. I have previously tried to use Prolog to solve it but my attempts
> were futile.
> Anyone has any idea how to approach it ?
>
> Who owns the fish? This is the question that Einstein posed last century
> when he stated that 98% of the population would be unable to solve it.
> Find out if you are one of the 2% who can...
> There are 5 houses in 5 different colors.
> 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 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.
> <http://www.tektron.co.uk/riddlesolution.html> Einstein
>
> ========================================================================
> ========================================
>
>
>
