Search code examples
logicrulesdroolsrule-enginesudoku

Solving Sudoku via Production Rules


I'm trying to solve any Sudoku puzzle using production rules, with Drools as my inference engine. One of the examples packed with Drools is precisely a Sudoku solver, here are the relevant rules:

http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/sudoku/sudokuSolver.drl

... But it doesn't work right. All of the time, one or more cells in the grid end up empty and the program reports the puzzle as "unsolved".

Has anybody built a working inference rule-based solver for Sudoku? it doesn't matter the language or engine used, I would like to see the set of rules so that I can adapt them for Drools


Solution

  • There's a sudoku solver written in CLIPS here: https://sourceforge.net/p/clipsrules/code/HEAD/tree/branches/63x/examples/sudoku/