@@ -7,7 +7,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* @class Sudoku
|
||||
* @brief Représente une grille de sudoku avec N symboles
|
||||
* @brief Represents a sudoku
|
||||
*/
|
||||
public class Sudoku {
|
||||
|
||||
@@ -39,10 +39,10 @@ public class Sudoku {
|
||||
return this.blocks.size();
|
||||
}
|
||||
|
||||
public Boolean isValid(List<IConstraint> constraints) {
|
||||
public boolean isValid(List<IConstraint> constraints) {
|
||||
//not implemented
|
||||
//for eachcase check contraintes
|
||||
throw new Error("Function isValid() not implemented");
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<Cell> getCells() {
|
||||
@@ -100,7 +100,11 @@ public class Sudoku {
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
constraint.getPossibleSymbols(this, coord.getX(), coord.getY());
|
||||
List<Integer> newPossibleSymbols = cell.getPossibleSymbols();
|
||||
newPossibleSymbols.retainAll(constraint.getPossibleSymbols(this, coord.getX(), coord.getY()));
|
||||
|
||||
cell.setPossibleSymbols(newPossibleSymbols);
|
||||
|
||||
if (cell.getPossibleSymbols().isEmpty()){
|
||||
throw new Exception("Rollback bitch");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user