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


//-------------------------------------------------------------------------- 
//  
//  Copyright (c) Microsoft Corporation.  All rights reserved.  
//  
//  File: BeginnerTechnique.cs 
// 
//  Description: Implements the Sudoku beginner technique. 
//  
//-------------------------------------------------------------------------- 
 
using System; 
using System.Drawing; 
using System.Collections; 
using Microsoft.Sudoku.Collections; 
 
namespace Microsoft.Sudoku.Techniques 
{ 
	/// Implements the beginner elimination technique. 
	[Serializable] 
	internal sealed class BeginnerTechnique : EliminationTechnique 
	{ 
		/// Initialize the technique. 
		public BeginnerTechnique(){} 
 
		/// Gets the difficulty level of this technique. 
		internal override uint DifficultyLevel { get { return 1; } } 
 
		/// Runs this elimination technique over the supplied puzzle state and previously computed possible numbers. 
		/// The puzzle state. 
		/// Whether the method can exit early when a cell with only one possible number is found. 
		/// The previously computed possible numbers. 
		/// The number of changes made by this elimination technique. 
		/// Whether the method exited early due to a cell with only one value being found. 
		/// Whether more changes may be possible based on changes made during this execution. 
		internal override bool Execute( 
			PuzzleState state, bool exitEarlyWhenSoleFound, 
			FastBitArray[][] possibleNumbers, out int numberOfChanges, out bool exitedEarly) 
		{ 
			numberOfChanges = 0; 
			exitedEarly = false; 
 
			int numLocations; 
			Point [] locations = new Point[state.GridSize]; 
 
			for(int n=0; n= state.GridSize) continue; 
 
				// For each box 
				for(int box=0; box 0, possibleNumbers was changed, but the state 
            // itself was not affected.  Thus, running this again won't help. 
			return false; 
		} 
	} 
}