Hi,
This is a puzzling one... but then again, I believe that is the idea.
I should have a very close look at it, but a loop always suggests that there
are rules that re-activate themselves or eachother.
For example:
rule "抽kools牌的香烟的人与养马的人是邻居"
when
$h1:House(cigarette == Cigarette.kools)
$h2:House(pet == Pet.horse)
$h3:House(eval(position - $h2.position == 1) || eval(position -
$h2.position == -1))
eval($h1.position - $h2.position != 1 && $h1.position - $h2.position
!= -1)
then
System.out.println("抽kools牌的香烟的人与养马(horse)的人是邻居");
modify($h1){setCigarette($h3.cigarette)};
modify($h3){setCigarette(Cigarette.kools)};
end
In this rule, $h3 and $h1 might be the same house OR $h1 and $h2 might be
the same house. I think you need to add extra constraints to make sure that
all 3 houses are different.
But still, I haven't had a thorough look at all the rules neither did I
refresh my knowledge of the zebrapuzzle, so I am not sure whether this is a
complete answer (if any).
Please let us know.
Regards,
Frank
--
View this message in context:
http://drools.46999.n3.nabble.com/rules-users-Can-I-solve-the-Zebra-Puzzl...
Sent from the Drools: User forum mailing list archive at
Nabble.com.