lecture de fichier +affichage debug
This commit is contained in:
24
Sudoku.java
24
Sudoku.java
@@ -2,7 +2,7 @@ public class Sudoku {
|
||||
private Grid grid;
|
||||
|
||||
public Sudoku() {
|
||||
this.grid = new Grid(); //grille de base
|
||||
this.grid = new Grid();
|
||||
}
|
||||
|
||||
public Grid getGrid() {
|
||||
@@ -10,19 +10,13 @@ public class Sudoku {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Sudoku sudoku = new Sudoku();
|
||||
sudoku.printGrid(); // Afficher la grille
|
||||
new SudokuUI(sudoku);
|
||||
}
|
||||
|
||||
public void printGrid() {
|
||||
for (int row = 0; row < 9; row++) {
|
||||
for (int col = 0; col < 9; col++) {
|
||||
int value = grid.getCell(row, col).getValue();
|
||||
System.out.print(value + " ");
|
||||
}
|
||||
System.out.println();
|
||||
if (args.length > 0) {
|
||||
Sudoku sudoku = new Sudoku();
|
||||
sudoku.getGrid().loadGridFromFile(args[0]);
|
||||
// Pas besoin d'afficher la grille ici, car loadGridFromFile() le fait déjà
|
||||
new SudokuUI(sudoku.getGrid());
|
||||
} else {
|
||||
System.err.println("Usage: java Sudoku <grid_file>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user