This commit is contained in:
@@ -192,6 +192,26 @@ public class MultiDoku {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (!(other instanceof MultiDoku))
|
||||
return false;
|
||||
MultiDoku otherDoku = (MultiDoku) other;
|
||||
if (this.getNbSubGrids() != otherDoku.getNbSubGrids())
|
||||
return false;
|
||||
for (int i = 0; i < this.getNbSubGrids(); i++) {
|
||||
Sudoku sudoku = this.getSubGrid(i);
|
||||
Sudoku otherSudoku = otherDoku.getSubGrid(i);
|
||||
if (sudoku.getSize() != otherSudoku.getSize())
|
||||
return false;
|
||||
for (int j = 0; j < sudoku.getSize() * sudoku.getSize(); j++) {
|
||||
if (sudoku.getCell(i).getSymbolIndex() != otherSudoku.getCell(i).getSymbolIndex())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public MultiDoku clone() {
|
||||
// TODO: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah
|
||||
return SudokuSerializer.deserializeSudoku(SudokuSerializer.serializeSudoku(this));
|
||||
|
||||
Reference in New Issue
Block a user