www.pudn.com > sudoku.rar > SolverResults.cs


//-------------------------------------------------------------------------- 
//  
//  Copyright (c) Microsoft Corporation.  All rights reserved.  
//  
//  File: SolverResults.cs 
// 
//  Description: Represents the results from the Sudoku solver. 
//  
//-------------------------------------------------------------------------- 
 
using System; 
using System.Collections; 
using Microsoft.Sudoku.Nullables; 
using Microsoft.Sudoku.Collections; 
 
namespace Microsoft.Sudoku 
{ 
	/// Represents the results from attempting to solve a Sudoku puzzle. 
	public sealed class SolverResults 
	{ 
		/// The status of the result. 
		private PuzzleStatus _status; 
		/// The puzzle states returned from the solver, containing at least one valid solution if status is PuzzleStatus.Solved. 
		private PuzzleStateCollection _puzzles = new PuzzleStateCollection(); 
		///  
		/// The number of decision points involved in finding the solution.  This is the number 
		/// of times that the solver had to use brute-force methods to make progress. 
		///  
		private int _numberOfDecisionPoints; 
		/// The use of each elimination technique. 
		private Hashtable _useOfTechniques; 
 
		/// Initializes the SolveResults. 
		/// The status of the result. 
		/// The puzzle state returned from the solver, a valid solution if status is PuzzleStatus.Solved. 
		///  
		/// The number of decision points involved in finding the solution.  This is the number 
		/// of times that the solver had to use brute-force methods to make progress. 
		///  
		/// The use of each elimination technique. 
		internal SolverResults(PuzzleStatus status, PuzzleState state, int numberOfDecisionPoints, Hashtable useOfTechniques) 
		{ 
			_status = status; 
			_puzzles.Add(state); 
			_numberOfDecisionPoints = numberOfDecisionPoints; 
			_useOfTechniques = useOfTechniques; 
		} 
 
		/// Gets the status of the result. 
		public PuzzleStatus Status { get { return _status; } } 
 
		/// Gets the first solution found by the solver. 
		public PuzzleState Puzzle 
		{ 
			get { return _puzzles.Count > 0 ? _puzzles[0] : null; } 
		} 
 
		/// Gets all of the solutions found by the solver. 
		public PuzzleStateCollection Puzzles { get { return _puzzles; } } 
 
		///  
		/// Gets or sets the number of decision points involved in finding the solution.  This is the number 
		/// of times that the solver had to use brute-force methods to make progress. 
		///  
		public int NumberOfDecisionPoints 
		{ 
			get { return _numberOfDecisionPoints; } 
			set { _numberOfDecisionPoints = value; } 
		} 
 
		/// Gets the use of each elimination technique. 
		internal Hashtable UseOfTechniques 
		{ 
			get { return _useOfTechniques; } 
		} 
	} 
}