Methodes en trop supprimée + nettoyage git

This commit is contained in:
2024-05-04 14:59:38 +02:00
parent 8adb8b4547
commit 12ae377ec0
5 changed files with 81 additions and 121 deletions

View File

@@ -3,22 +3,22 @@ import java.io.FileInputStream;
import java.io.IOException;
public class Grid {
private Cell[][] cells;
private Cell[][] cell;
public Grid() {
cells = new Cell[9][9];
cell = new Cell[9][9];
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
cells[i][j] = new Cell();
cell[i][j] = new Cell();
}
}
}
public Grid(Grid grid) {
cells = new Cell[9][9];
cell = new Cell[9][9];
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
cells[i][j] = new Cell(grid.cells[i][j].getValue());
cell[i][j] = new Cell(grid.cell[i][j].getValue());
}
}
}
@@ -32,9 +32,9 @@ public class Grid {
line = "000000000".substring(length) + line; // Ajoute les zéros au début si nécessaire
}
for (int column = 0; column < 9; column++) {
char digit = line.charAt(column);
int value = Character.getNumericValue(digit);
cells[ligne][column].setValue(value);
char number = line.charAt(column);
int value = Character.getNumericValue(number);
cell[ligne][column].setValue(value);
}
}
System.out.println("Success");
@@ -45,13 +45,13 @@ public class Grid {
}
public Cell getCell(int ligne, int col) {
return cells[ligne][col];
return cell[ligne][col];
}
public void copyFrom(Grid other) {
public void copyFrom(Grid second_grid) {
for (int row = 0; row < 9; row++) {
for (int col = 0; col < 9; col++) {
this.cells[row][col].setValue(other.cells[row][col].getValue());
this.cell[row][col].setValue(second_grid.cell[row][col].getValue());
}
}
}
@@ -59,7 +59,7 @@ public class Grid {
public void printGrid() {
for (int row = 0; row < 9; row++) {
for (int col = 0; col < 9; col++) {
System.out.print(cells[row][col].getValue() + " ");
System.out.print(cell[row][col].getValue() + " ");
}
System.out.println();
}