Example #1
0
	static bool IsGoodSchemaSequenceOriginal (const CellVector &theCellVector){
		size_t aNumTotal = std::count_if (theCellVector.begin (), theCellVector.end (), SCountHelper (0));
		bool rit = true;
		for (CellValue aCellValue = 0; aCellValue < kDim && rit; ++aCellValue){
			const size_t aNumValue = std::count_if (theCellVector.begin (), theCellVector.end (), SCountHelper (aCellValue + 1));
			/*
			const size_t aNumValue = std::count_if (theCellVector.begin (), theCellVector.end () , [aCellValue] (const Cell * theIter) -> bool{
				LogicAssert (true == IsGoodPtr (theIter));
				return theIter->GetValue () == aCellValue + 1;
			});
			*/
			aNumTotal += aNumValue;
			rit = ((1 == aNumValue) || (0 == aNumValue));
		}
		return (kDim == aNumTotal) && rit;
	}
Example #2
0
	static bool IsGoodSolutionSequence (const CellVector &theCellVector){
		LogicAssert (true == IsGoodSchemaSequence (theCellVector));
		bool rit = true;
		for (CellValue aCellValue = 0; aCellValue < kDim && rit; ++aCellValue){
			const size_t aNumValue = std::count_if (theCellVector.begin (), theCellVector.end () , SCountHelper (aCellValue + 1));
			/*
			const size_t aNumValue = std::count_if (theCellVector.begin (), theCellVector.end () , [aCellValue] (const Cell * theIter){
				LogicAssert (true == IsGoodPtr (theIter));
				return theIter->GetValue () == aCellValue + 1;
			});
			*/
			rit = (1 == aNumValue);
		}
		return rit;
	}
Example #3
0
	static std::size_t CountFree (const CellVector &theCellVector){
		return std::count_if (theCellVector.begin (), theCellVector.end (), MyCountFree);
	}
Example #4
0
	static bool IsAvailable (const CellVector &theCellVector, const CellValue theCellValue){
        LogicAssert ((theCellValue >= 1) && (theCellValue <= 9));

        const CellVector::const_iterator aIterResult = std::find_if (theCellVector.begin (), theCellVector.end () , SFindHelper (theCellValue));
        return  theCellVector.end () == aIterResult;
	}