private bool Backtracking(Cell cell) { if (sudokuFound) Thread.CurrentThread.Abort(); if (this.IsFilledSudoku) return true; if(cell == null) return false; Cell nextCell = null; int nextIndex = allCells.IndexOf(cell) + 1; if (nextIndex < allCells.Count) nextCell = allCells[allCells.IndexOf(cell) + (int)1]; /* if (cell.IsInitialized) { if (Backtracking(nextCell)) return true; }*/ for (int value = 1; value <= 9; value++) { if (!cell.Matrix.HaveTheSame(value) && !HaveTheSameH(cell.Matrix, cell, value) && !HaveTheSameV(cell.Matrix, cell, value)) { Fill(cell.Matrix.X, cell.Matrix.Y, cell.X, cell.Y, value); if (Backtracking(nextCell)) return true; } } cell.ClearCell(); return false; }