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


//-------------------------------------------------------------------------- 
//  
//  Copyright (c) Microsoft Corporation.  All rights reserved.  
//  
//  File: BlockAndColumnRowInteractionTechnique.cs 
// 
//  Description: Implements the Sudoku block and column/row interaction technique. 
//  
//-------------------------------------------------------------------------- 
 
using System; 
using System.Drawing; 
using System.Collections; 
using Microsoft.Sudoku.Collections; 
 
namespace Microsoft.Sudoku.Techniques 
{ 
	/// Implements the coloring elimination technique. 
	[Serializable] 
	internal sealed class BlockAndColumnRowInteractionTechnique : EliminationTechnique 
	{ 
		/// Initialize the technique. 
		public BlockAndColumnRowInteractionTechnique(){} 
 
		/// Gets the difficulty level of this technique. 
		internal override uint DifficultyLevel { get { return 4; } } 
 
		/// Runs this elimination technique over the supplied puzzle state and previously computed possible numbers. 
		/// The puzzle state. 
		/// The previously computed possible numbers. 
		/// The number of changes made by this elimination technique. 
		/// 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; 
 
			// Find the open cells in this block 
			int numLocations; 
			Point [] foundLocations = new Point[state.GridSize]; 
 
			// Analyze each box 
			for(int box=0; box 1 && numLocations <= state.BoxSize) 
					{ 
						bool matchesRow = true, matchesColumn = true; 
						int row = foundLocations[0].X; 
						int column = foundLocations[0].Y; 
						for(int i=1; i