Francesco did a great work when he designed KSudoku. It won the second place in a contest of Linux Format and had support for different variants of sudoku-like games from the beginning on. Even 3D puzzles are possible. It was the generic graph coloring solver which made this success possible.
Unfortunately this solver is limited to graph coloring and not very easy to maintain. This is the reason why I'm writing a new generic engine for logic problems codenamed Logine. In theory it is able to solve any logical problem that results in one (or more) static solution(s). This flexibility is reached by an extensible high performance C++ core and QtScript-based descriptions of the rules.
/* Small script demonstrating how to setup rules */ // Create a board var board = new logine.Board(9, 9); ruleset.addItem(board); // Make this board accessible for the application. ruleset.content.board = board; // Add cells to board for(var x = 0; x < 9; ++x) { for(var y = 0; y < 6; ++y) { var item = new logine.Choice(item, 9); board.setItem(item, x, y); } } // Add containers for rows, columns and blocks ruleset.content.rows = new Array(); ruleset.content.columns = new Array(); ruleset.content.blocks = new Array(); // Add all rows and columns for(var i = 0; i < 9; ++i) { var row = new logine.Sudoku(board.itemsAt(-1, i)); ruleset.content.rows.push(row); ruleset.addItem(row); var column = logine.Sudoku(board.itemsAt(i, -1) ruleset.content.columns.push(column); ruleset.addItem(column); } // Add all blocks var blocks = board.split(3, 3); for(var i = 0; i < blocks.size(); ++i) { var block = new logine.Sudoku(blocks[i]); ruleset.content.blocks.push(block); ruleset.addItem(block); }
This script will setup the rules for a standard 9x9 sudoku. This is enough for playing and solving it. Further code is required for generating games and for interactive help. Yes you read right! Interactive help! The new core is able to provide interactive help for all games generated by the computer or even entered by the user.
Not everything is completely done but I'm alomst there. So you can look forward to a great KSudoku in 4.3.