feat: add constraint management and validation to Sudoku class
This commit is contained in:
@@ -2,6 +2,8 @@ package sudoku;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -23,6 +25,9 @@ public class TestBloc {
|
||||
Symbole.of(8),
|
||||
Symbole.of(9))));
|
||||
|
||||
// Add constraints
|
||||
sudoku.ajouterContrainte(new ContrainteBloc());
|
||||
|
||||
sudoku.getGrille().setCase(0, 0, Symbole.of(1));
|
||||
sudoku.getGrille().setCase(6, 1, Symbole.of(2));
|
||||
sudoku.getGrille().setCase(2, 2, Symbole.of(3));
|
||||
@@ -34,8 +39,9 @@ public class TestBloc {
|
||||
sudoku.getGrille().setCase(4, 8, Symbole.of(9));
|
||||
//doublon bloc
|
||||
sudoku.getGrille().setCase(1, 1, Symbole.of(1));
|
||||
assertFalse(sudoku.estValide(sudoku.getGrille().getCase(1, 1)));
|
||||
|
||||
sudoku.getGrille().createSquareBlocs();
|
||||
sudoku.getGrille().creerBlocCarre();
|
||||
|
||||
System.out.println("Sudoku :");
|
||||
System.out.println(sudoku.getGrille().toString());
|
||||
|
||||
Reference in New Issue
Block a user