www.pudn.com > sudoku.rar > SolverOptions.cs
//--------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: SolverOptions.cs
//
// Description: Options for the Sudoku solver.
//
//--------------------------------------------------------------------------
using System;
using Microsoft.Sudoku.Nullables;
using Microsoft.Sudoku.Collections;
namespace Microsoft.Sudoku
{
/// Options for configuring how the solver does its processing.
public sealed class SolverOptions : ICloneable
{
/// The maximum number of solutions the solver should find.
private NullableUint _maximumSolutionsToFind = 1;
/// Whether to allow brute-force techniques in the solver.
private bool _allowBruteForce = true;
/// The techniques to use while solving.
private TechniqueCollection _techniques;
/// Initializes the SolverOptions.
public SolverOptions() {}
/// Gets or sets the maximum number of solutions the solver should find.
public NullableUint MaximumSolutionsToFind
{
get { return _maximumSolutionsToFind; }
set
{
if (value <= 0u) throw new ArgumentOutOfRangeException("value");
_maximumSolutionsToFind = value;
}
}
/// Gets or sets the techniques used for solving.
public TechniqueCollection EliminationTechniques
{
get
{
if (_techniques == null) _techniques = new TechniqueCollection();
return _techniques;
}
set { _techniques = value; }
}
/// Gets or sets whether to allow brute-force techniques in the solver.
public bool AllowBruteForce { get { return _allowBruteForce; } set { _allowBruteForce = value; } }
/// Clones the solver options.
/// A clone of the options.
public SolverOptions Clone()
{
return (SolverOptions)MemberwiseClone();
}
/// Clones the solver options.
/// A clone of the options.
object ICloneable.Clone() { return Clone(); }
}
}