Ossudo - ultimage open source sudoku

Friday, August 25, 2006

The features of Ossudo

Here are the main features of Ossudo:
  • Where algorithms are concerned
    • It has many, almost all, solving algorithms, that is 6 at the current time. I did find some http://www.angusj.com/sudoku/hints.php that I have not coded yet, but they are so seldom needed that I wonder if it’s worth it.
    • It builds new Sudokus and evaluates them by solving them. In order to solve a Sudoku, it tries the easiest algorithms first, as long as it can fill cells, then turns to a more difficult algorithm, finds another cell, and goes back to easy ones if possible. Thus, when a Sudoku is solved, the evaluator knows exactly how many runs of each algorithms it took, from easiest to most advanced. When all algorithms have been applied and no cell can be determined, it does some trial-and-error as well, choosing a cell with the fewests possible candidates. It does as little trial and error as possible, meaning after trying just one cell, it will turn back to algorithm solving. The number of times that trial and error was required is also recorded and impacts evaluation. Any board that requirest trial-and-error is at minimum “expert”, and if there were too many, it is called “crazy”.
  • Where user interface, playing features and usability are concerned
  • It optionnaly provides hints as you play. Either a single hint or many hints, on all cells that can be found with simple algorithms at a given time.
  • It will also tell you the value on a given cell, if you ask.
  • It will tell you exactly and precisely which algorithm it applies and which algorithms are necessary to solve a given Sudoku.
  • Based on that, it gives an accurate assessment of difficulty level, finer than just (easy, medium, hard).
  • It lets you enter any Sudoku, and will analyse and evaluate it for you, telling you if it’s correct or not.
  • It has a scalable user interface, with scalable fonts.
  • It will save and load Sudokus as Xml files.
  • It allows you to print a Sudoku, as it is on screen, that is with or without hints, and possible values.
  • It optionnaly will display possible values for each cell.
  • Since it can solve absolutely ANY Sudoku, no matter how hard, it knows which values are correct, and will optionnaly tell you as you proceed.
  • Where environment and source code are concerned
  • It’s written in C# for .Net 2.0, using Visual Studio 2005. I wish I could port it to Java/SWT as well, it should not be too difficult since user interface is quite compact, most of the code is algorithms.
  • I tried to make it as clean as possible, with a true object oriented approach. The main class hierarchy is as follows:
  • SudoArray: The basic 9x9 array of cells, with get/set methods and little more.
  • SudoArrayWithVectors: SudoArray. An array together with a permanent update of a number of vectors that hold values found in rows, columns and blocs, as well as remaining candidate values. No real algorithm at this level, but exceptions thrown if an attempt is made to set a cell incorrectly. Not because it is not the final value, final values are not known by this class, but because it breaks some of the rules.
  • SudoFinder: SudoArrayWithVectors. It holds all the solving algorithms. Maybe I could break it a little more, separating the trial-and-error from rule-based.
  • SudoPlayer: SudoFinder. It holds information for a game being analysed and played. The moves that where perfomed, the final values. Little added-value actually.
  • SudoMaker: SudoFinder. It is the class that builds new Sudokus. It relies on all algorithms to check Sudokus as they are made up. It clears cells as long as it can, while still having a unique solution. This is a big difference with Pocket Sudoku for instance: a difficult Sudoku is not one with many cells cleared, it is one which requires difficult algorithms to be solved.

1 Comments:

  • Patrice,

    Nice work, thanks. but you chose to deploy this app. with a silent install and no start-up icon. Now that I installed it, I have the following questions:
    - Where in heaven is this app. installed to (which dir)?
    - Why does it print sideways (tilted ~15deg. to the right)?
    - How do you un-install it (not found in the Add/Remove Win applet)?
    - Is all the above intentional or did I miss something?

    Dan

    By Blogger danT, at 2:08 AM  

Post a Comment

Links to this post:

Create a Link

<< Home