Show / Hide Table of Contents

Namespace SudokuSpice.ConstraintBased

Classes

ExactCoverGraph

Holds an exact-cover graph for the current puzzle being solved.

This is an extension of the exact-cover matrix concept. Rows of the exact-cover matrix, i.e. a specific location and possible value for that location, are represented by Possibility objects. These are linked together by IObjective objects, which represent the columns of an exact-cover matrix.

For example, the RowUniquenessConstraint uses a required Objective to link all the Possibility objects on a single row that have the same possible value. This way, when one of these possibilities is selected, then the others are all dropped.

To extend the concept into a larger graph, this also uses OptionalObjectives to create subgroups over Possibility objects and/or other OptionalObjective objects. This allows for much more complex constraints, such as the MagicSquaresConstraint.

Objective

A required objective in the ExactCoverGraph. This enforces that one or more IPossibilitys must be selected.

OptionalObjective

An optional objective in an ExactCoverGraph. An optional objective is both an IObjective and an IPossibility.

This can be satisfied if one or more attached IPossibility objects are selected. Once satisfied, this drops any remaining unknown possibilities, and notifies parent objectives that to select this possibility.

Unlike Objectives, this class can be dropped. Dropping this objetive does not immediately impact attached possibilities. These possibilities may still be dropped or selected, as long as this objective does not become satisfied. If selecting a possibility would satisfy a dropped optional objective, then the call to SudokuSpice.ConstraintBased.IObjective.TrySelectPossibility(SudokuSpice.ConstraintBased.Link) will fail.

All OptionalObjective objects must eventually be descendents of at least one Objective.

Possibility

A concrete possibility in the ExactCoverGraph. This represents a single possible value for a single square in the puzzle.

PuzzleSolver<TPuzzle>

Solves puzzles of the given type using an ExactCoverGraph.

StandardPuzzles

Provides utilities for interacting with standard Sudoku puzzles.

Interfaces

IObjective

Defines an objective in the ExactCoverGraph graph.

IOptionalObjective

IPossibility

Defines a possibility in the ExactCoverGraph.

Enums

NodeState

Indicates if an IPossibility or IObjective is still possible, selected, or dropped.

In This Article
Back to top Generated by DocFX