Drools puzzle #1

I completely missed the announcement for the Drools puzzles but it looks like lots of fun. Here's my solution to the first puzzle using Clips. You run it by executing the batch file:

CLIPS> (batch "... /ages-of-the-sons.bat")
CLIPS> (clear)
CLIPS> (load "ages-of-the-sons.clp")
CLIPS> (generate-ages)
CLIPS> (run)
What are the ages of the three sons of the old man?
2, 2 and 9
10 rules fired
40 mean number of facts (44 maximum).
0 mean number of instances (0 maximum).
4 mean number of activations (8 maximum)

3 kommentarer:

Mark Proctor sa...

The Drools Clips parser isn't finished yet, once 4.0.1 is out next week, I'll make another push to finish this. The good thing is once it's out you'll be able to convert clp to drl without a problem. In the mean time why not take this opportunity to explore and understand drl. I believe it's a much better and more declarative syntax that clp.

Johan Lindberg sa...

Hi Mark,
have you been reading my submission e-mail for the second puzzle? ;-)

Last night I submitted a solution to the second puzzle using Clips. I also admitted to not having tried it with the Drools Clips parser cause I haven't got the 4.0 release set up just yet.

I know, I know. I *should* be ashamed of myself. And I am... a little. It's been on my to-do list forever (well since you announced it anyway) but I still haven't managed to even unzip it. But I will, honest.

Mark Proctor sa...

Someone else in the community manages the puzzles, although they do forward stuff to me. Yes I saw your email about not having tried it with drools-clips. Which is why I mentioned it's not finished or working yet, hopefully end of September should having something working that you will be able to use to execute Clips/Jess stuff.