public Sudoku(List<int> values) { Difficulty = 1; Rem1 = -1; Rem2 = -1; Rem3 = -1; NrSolutions = 0; Fields = new Field[9][]; for (int i = 0; i < 9; i++) { Fields[i] = new Field[9]; for (int j = 0; j < 9; j++) { Fields[i][j] = new Field(i, j); } } // Llenar el sudoku con los valores dados int a = 0; int b = 0; for (int x = 0; x < values.Count; x++) { if (values[x] != 0) { Fields[b][a].Value = values[x]; Fields[b][a].NewFound = true; Fields[b][a++].Filled = true; } else a++; if (a > 8) { a = 0; b++; } } }
public Sudoku(TextBox[][] values) { Difficulty = 1; Rem1 = -1; Rem2 = -1; Rem3 = -1; NrSolutions = 0; Fields = new Field[9][]; for (int i = 0; i < 9; i++) { Fields[i] = new Field[9]; for (int j = 0; j < 9; j++) { Fields[i][j] = new Field(i, j); if (values[i][j].Text != "") { Fields[i][j].Value = int.Parse(values[i][j].Text); Fields[i][j].NewFound = true; Fields[i][j].Filled = true; } } } }
private GameController() { field = new Field(); active = new IntPoint(-1, -1); }
public void clean() { active = new IntPoint(-1, -1); field = new Field(); }
public bool BelongsToBox(int i, int j, Field f) { int iStart = i - i % 3; int jStart = j - j % 3; if (f.i >= iStart && f.i <= iStart + 2 && f.j >= jStart && f.j <= jStart + 2) return true; else return false; }
public Field Copy() { Field Result = new Field(i, j); foreach (int ii in Candidates) Result.Candidates.Add(ii); Result.Filled = Filled; Result.Value = Value; Result.NewFound = NewFound; return Result; }