The road to Perfection

I have brought 2 releases of SudoCue to the site in a very short period of time. The visible improvements can be seen on the release notes page of the www.sudocue.net website, but the internal restructuring is not seen by the outside world. Here are a few notes on how the architecture has changed.

First, a virtual class named Trick has been added. This class can save itself to the configuration file, has a name, a base score, a sequence number, an optional administration score, several classification flags, tries and usage counters, and a Performed method which reports a successful application of the trick.

A Tricks class contains a collection of Trick instances which can be enumerated.

The user can enable or disable any of these tricks through the options panel, and also change the order in which they are tried.

Several tricks that are basically different sizes of a single technique have a base class that performs the technique, with the size property of the derived class as a parameter. There are 2 tricks which are kept at the end of the collection, the DLX brute force solver and a Surrender class the does nothing, but declares the puzzle unsolvable. This trick cannot be disabled by the user for obvious reasons.

The only thing that I need to add a new technique is define a new class derived from the Trick class and add it initially to the Tricks collection. In earlier versions, I had to change the Log, the Options class, the Options dialog, the main solving method in the Grid class and the Analyzer dialog, even before I could start coding the nitty gritty stuff. This hassle disencouraged me from quickly adding new tricks.

There is also a strict separation between setup and play mode. The solver does nothing in setup mode, but validates and rates the puzzle when you switch to play mode. Earlier, the program had the habit of kicking in too soon, filling the log with complicated tabling chains when all it had to do it wait for all the clues to arrive. With uniqueness, this could even lead to a solving path going the wrong way.

With these changes, the program is ready to be expanded with all the lovely tricks that have been developed in the last months. Some have already been added to the program. More will follow.