[rules-users] conways game of life

Mark Proctor mproctor at redhat.com
Mon Apr 16 10:10:23 EDT 2007


I have just moved Jeff Brown's "Conways Game of Life" to a stateful
example, this is now the best place to look to understand jboss rules.
It's also good to compare this stateful implementation to the old
stateless version. Trunk introduces a new feature to help deal with
recursion "lock-on-active" which stops a rule being able to create
activations while it's agenda-group/rule-flow-group has focus - so it's
a much stronger no-loop. Probably the most important thing this example
shows is how to think relationally, the old example used nested
properties and sets to maintain the "neighbour" information; this
example shows how to achieve the same but expressing it relationally,
using the Neighbor relation class, further it shows how we can exploit
the the cross-product relational information to drive the engine without
us having to write loops. Currently the example is using agenda-groups
to drive execution flow, I'm now in the process of moving this to
rule-flow-groups.

You'll need trunk to be able to run this, so checkout:
http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/
Make sure you have maven 2.0.6 installed and then type the following
from the root directory:
mvn clean install -Declipse=true
The eclipse plugin will now be built in the drools-eclipse/target
directory, so open that up and unzip into your eclipse install (make
sure you use -clean to start eclipse). Then import drools-examples and
"run as application" the ConwayGUI class.

I plan to do a blog or two on how this exampe works, and my next
challenge will be to migrate the pacman game to jboss rules.

Mark

-- 
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod 
Street, Windsor, Berkshire,
SI4 1TE, United Kingdom.
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA) and David 
Owens (Ireland)


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: conway.drl
Url: http://lists.jboss.org/pipermail/rules-users/attachments/20070416/448a256d/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Cell.java
Url: http://lists.jboss.org/pipermail/rules-users/attachments/20070416/448a256d/attachment-0001.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CellGrid.java
Url: http://lists.jboss.org/pipermail/rules-users/attachments/20070416/448a256d/attachment-0002.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Neighbor.java
Url: http://lists.jboss.org/pipermail/rules-users/attachments/20070416/448a256d/attachment-0003.pl 


More information about the rules-users mailing list