// ------------------------------------------------------------------------------- public static bool Edit(Grid[,] Grids, int RowIndex, int ColumnIndex, int Mode = 1) { // bool FlagError = false; s_RowIndex = RowIndex; s_ColumnIndex = ColumnIndex; s_Grids = Grids; s_Node = Grids[RowIndex, ColumnIndex].Node; s_Row = Grids[RowIndex, ColumnIndex].Row; s_Column = Grids[RowIndex, ColumnIndex].Column; s_Value = Grids[RowIndex, ColumnIndex].Value; if (Mode == 1) { Clear(Grids); } //if (_Row(Grids)) //if (_Column(Grids)) //if (_Node(Grids)) //if (_Row(Grids) | _Column(Grids)) if (_Node() | _Column() | _Row()) { FlagError = true; Grids[RowIndex, ColumnIndex].Control = Grid.Flag.ERROR; MessageText.SudokuError(); } else { Grids[RowIndex, ColumnIndex].Control = Grid.Flag.OK; MessageText.SudokuOk(); } if (Mode == 1) { Solver(); } Grids[RowIndex, ColumnIndex].Edit(); //ShowText(); return(FlagError); }
// ------------------------------------------------------------------------------- public static bool All(Grid[,] Grids) { // Проверка всей сетки. bool FlagError = false; Clear(Grids); for (int Row = 0; Row < 9; Row++) { for (int Column = 0; Column < 9; Column++) { if (Edit(Grids, Row, Column, 0)) { FlagError = true; } } } if (FlagError) { MessageText.SudokuError(); // Есть ошибки. } else { if (Global.isStatusGridsFull()) { MessageText.SudokuVictory(); // Вы выиграли. Судока решена. } else { MessageText.SudokuOk(); // Ошибок нет. } } return(FlagError); }