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 Discussion
Output Summary
Conway's Game Of Life

Getting the Examples

Make sure the Drools Eclipse plugin is installed, which needs the Graphical Editing Framework (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 set up the dependencies by hand, of course. Many, but not all of the examples are documented below, enjoy!