/// <summary> /// 复制当前列表 /// </summary> /// <returns></returns> private LiveNumbers[,] CopySudokuLiveNumber() { LiveNumbers[,] tmpArr = new LiveNumbers[9, 9]; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { tmpArr[i, j] = SudokuLiveNumbersArry[i, j].Clone() as LiveNumbers; } } return(tmpArr); }
/// <summary> /// 按步骤进行计算 /// </summary> public void RunCalcsByStep() { if (!IsCalcsMode) { MessageBox.Show("计算模式没有开启!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (isCalcsOver) { SetMessage("计算完成。", SudokuMessageType.Success); StopCalcs(); return; } while (TurnCount == 1 && !isCalcsOver && IsCalcsMode) { if (ColIndex >= 9) { RowIndex++; ColIndex = 0; } if (RowIndex >= 9) { TurnCount++; return; } LiveNumbers tmpL = SudokuLiveNumbersArry[RowIndex, ColIndex]; if (tmpL.IsSet) { ShowSudokuDelectNumber(tmpL.Value, RowIndex, ColIndex); ColIndex++; break; } ColIndex++; if (CheckSudoku()) { return; } } if (!isCalcsOver && TurnCount >= 2 && IsCalcsMode) { FindItem(); if (CheckSudoku()) { return; } } SetCalcFontStyle();//更新文本字体 }
/// <summary> /// 快速计算 /// </summary> public void RunCalcs() { if (!IsCalcsMode) { MessageBox.Show("计算模式没有开启!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (CheckSudoku()) { return; } while (TurnCount == 1 && !isCalcsOver && IsCalcsMode) { if (ColIndex >= 9) { RowIndex++; ColIndex = 0; } if (RowIndex >= 9) { TurnCount++; break; } LiveNumbers tmpL = SudokuLiveNumbersArry[RowIndex, ColIndex]; if (tmpL.IsSet) { ShowSudokuDelectNumber(tmpL.Value, RowIndex, ColIndex); ColIndex++; continue; } ColIndex++; if (CheckSudoku()) { return; } } while (!isCalcsOver && IsCalcsMode) { FindItem(); if (CheckSudoku()) { return; } } }