Chapter 8. Examples

Table of Contents

Getting the examples
Hello World
State Example
Understanding the State Example
Fibonacci Example
Banking Tutorial
Pricing Rule Decision Table Example
Executing the example
The decision table
Pet Store Example
Honest Politician Example
Sudoku Example
Sudoku Overview
Running the Example
Java Source and Rules Overview
Sudoku Validator Rules (validatorSudoku.drl)
Sudoku Solving Rules (solverSudoku.drl)
Suggestions for Future Developments
Number Guess
Miss Manners and Benchmarking
Introduction
Indepth look
Output Summary
Conways Game Of Life Example

Getting the examples

Make sure the Drools Eclipse plugin is installed, which needs GEF dependency installed first. Then download and extract the drools-examples zip file, which includes an already created Eclipse project. Import that project into a new Eclipse workspace. The rules all have example classes that execute the rules. If you want to try the examples in another project (or another IDE) then you will need to setup the dependencies by hand of course. Many, but not all of the examples are documented below, enjoy :)