doc: constraints
All checks were successful
Linux arm64 / Build (push) Successful in 42s

This commit is contained in:
2025-02-02 22:25:28 +01:00
parent d7d7dfe787
commit a580321bd0
6 changed files with 22 additions and 28 deletions

View File

@@ -1,22 +1,12 @@
package sudoku.constraint;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import sudoku.structure.Sudoku;
public interface IConstraint extends Serializable {
/**
* Interface de base pour la déclaration d'une contrainte
* Elle est en théorie assez générique pour implémenter n'importe quelle
* contrainte
*/
public interface IConstraint {
boolean canBePlaced(final Sudoku s, int x, int y, int newSymbolIndex);
default List<Integer> getPossibleSymbols(final Sudoku s, int x, int y) {
List<Integer> possibilities = new ArrayList<>();
for (int i = 0; i < s.getSize(); i++) {
if (canBePlaced(s, x, y, i)) {
possibilities.add(i);
}
}
return possibilities;
}
}