public static Sudoku ReadCSV() { Sudoku sudoku = new Sudoku(9); int i = 0; int rnd = GenerateRandomNumber(5); MainWindow.num = rnd + 1; StreamReader reader; switch (rnd) { case 0: reader = new StreamReader(@"sudoku1.csv"); MainWindow.diff = "Easy"; break; case 1: reader = new StreamReader(@"sudoku2.csv"); MainWindow.diff = "Medium"; break; case 2: reader = new StreamReader(@"sudoku3.csv"); MainWindow.diff = "Hard"; break; case 3: reader = new StreamReader(@"sudoku4.csv"); MainWindow.diff = "Hell"; break; case 4: reader = new StreamReader(@"sudoku5.csv"); MainWindow.diff = "Hard"; break; default: reader = new StreamReader(@"sudoku1.csv"); break; } //reader = new StreamReader(@"test.csv"); //Remplacer par adresse du fichier using (reader) { while (!reader.EndOfStream) { var line = reader.ReadLine(); var values = line.Split(';'); for (int j = 0; j < 9; j++) { if (Int16.Parse(values[j]) != 0) { sudoku.mySudoku[i][j].setValue(Int16.Parse(values[j])); } } i = i + 1; } } return(sudoku); }
public Arc(Sudoku sudoku, int i1, int j1, int i2, int j2) { this.xi = sudoku.mySudoku[i1][j1]; this.xj = sudoku.mySudoku[i2][j2]; }
/** * On selectionne la variable qui contraint le plus de variables et on renvoie sa position i,j * On appelle selectDH après avoir appelé selectMRV */ public static (int, int) selectDH(Sudoku sudoku, List <(int, int)> resultMRV)