Drools puzzle #2
The second Drools puzzle was a lot trickier than the first one. It took a while for me to figure out a solution I was content with. I re-wrote the application three times before settling on this one. It's a rather simple generate-and-test solution but it works and it's not unreasonably slow.
CLIPS> (batch ".../family.bat")I hope more people have sent in solutions this time and that the next puzzle will be as good as this one.
TRUE
CLIPS> (clear)
CLIPS> (unwatch all)
CLIPS> (load "family.clp")
:::%%%********!!
TRUE
CLIPS> (solve)
Who is married to whom and what are their sons called?
1 solution(s).
Snyder is married to Edith and their son is Victor
Locker is married to Doris and their son is Henry
Abel is married to Luisa and their son is Albert
CLIPS>
Inga kommentarer:
Skicka en kommentar