This commit is contained in:
@@ -8,29 +8,22 @@ import java.util.List;
|
||||
*/
|
||||
public class Sudoku {
|
||||
|
||||
private final List<Bloc> blocs;
|
||||
private final List<Case> cases;
|
||||
private final List<Block> blocks;
|
||||
private final List<Cell> cells;
|
||||
|
||||
public Sudoku(List<Case> cases, List<Bloc> blocs) {
|
||||
// assert(symbolCount >= 2);
|
||||
// // initialisation des cases
|
||||
// this.cases = new ArrayList<>(symbolCount * symbolCount);
|
||||
// Collections.fill(this.cases, new Case());
|
||||
// // initialisation des blocs
|
||||
// this.blocs = new ArrayList<>(symbolCount);
|
||||
// Collections.fill(this.blocs, new Bloc(null));
|
||||
this.cases = cases;
|
||||
this.blocs = blocs;
|
||||
public Sudoku(List<Cell> cells, List<Block> blocks) {
|
||||
this.cells = cells;
|
||||
this.blocks = blocks;
|
||||
}
|
||||
|
||||
public Case getCase(int x, int y) {
|
||||
public Cell getCell(int x, int y) {
|
||||
int index = y * getSize() + x;
|
||||
assert(index < getSize() * getSize());
|
||||
return this.cases.get(index);
|
||||
return this.cells.get(index);
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return this.blocs.size();
|
||||
return this.blocks.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user