25.6. Sudoku Example: Validate.drl

  • Sudoku Validator Rules (validate.drl) detect duplicate numbers in cell groups. They are combined in an agenda group which enables them to be activated after loading a puzzle.
  • The three rules duplicate in cell... are very similar. The first pattern locates a cell with an allocated value. The second pattern pulls in any of the three cell groups the cell belongs to. The final pattern finds a cell with the same value as the first cell and in the same row, column or square, respectively.
  • Rule terminate group fires last. It prints a message and calls halt.