本文整理汇总了C#中ErrorLogger.getBoard方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorLogger.getBoard方法的具体用法?C# ErrorLogger.getBoard怎么用?C# ErrorLogger.getBoard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorLogger
的用法示例。
在下文中一共展示了ErrorLogger.getBoard方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: solve
public ErrorLogger solve(ref bool foundSolution)
{
/*
* This call is recursive, or will create new boards
* */
ErrorLogger RV = new ErrorLogger();
RV = checkBoardValidity();
if (RV.hasError()) return RV;
//if program has made it this far, problem is valid
Console.WriteLine("----BEGIN SOLVE-----");
bool madeChange = true;
while (madeChange)
{
madeChange = false;
RV = levelOneTests(ref madeChange);
if (RV.hasError() ) break;
if (madeChange) continue; //don't bother with level two unless level one made no changes
RV = levelTwoTests(ref madeChange);
if (RV.hasError()) break;
if (madeChange) continue; //don't bother with level two unless level one made no changes
}
if (checkForSolution())
{
if (!RV.hasError())
{
foundSolution = true;
RV = RV + new ErrorLogger(this);
}
}
else
{
//if code enters here it could not find a solution, it should make a guess and call solve again
if (!RV.hasError())
{
RV = RV + makeGuesses(ref foundSolution);
if (foundSolution)
{
if (RV.hasBoard())
{
short[] tArray = RV.getBoard().getArray();
//fills in correct board
for (int i = 0; i < 81; i++)
{
if (numBoxes[i].getValue() == 0)
{
insertNum(numBoxes[i], tArray[i]);
}
}
}
}
}
}
return RV;
}