This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
package sudoku.constraint;
|
||||
|
||||
import sudoku.Bloc;
|
||||
import sudoku.Case;
|
||||
import sudoku.Block;
|
||||
import sudoku.Cell;
|
||||
import sudoku.Sudoku;
|
||||
|
||||
public class BlockConstraint implements IConstraint{
|
||||
|
||||
@Override
|
||||
public boolean canBePlaced(final Sudoku s, int x, int y, int newSymbolIndex) {
|
||||
Bloc bloc = s.getCase(x, y).getBloc();
|
||||
return !bloc.getCases().contains(new Case(newSymbolIndex));
|
||||
Block bloc = s.getCell(x, y).getBlock();
|
||||
return !bloc.getCells().contains(new Cell(newSymbolIndex));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ public class ColumnConstraint implements IConstraint {
|
||||
@Override
|
||||
public boolean canBePlaced(final Sudoku s, int x, int y, int newSymbolIndex) {
|
||||
for (int i = 0; i < s.getSize(); i++) {
|
||||
if (s.getCase(x, newSymbolIndex).getSymboleIndex() == newSymbolIndex)
|
||||
if (s.getCell(x, newSymbolIndex).getSymboleIndex() == newSymbolIndex)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -7,7 +7,7 @@ public class LineConstraint implements IConstraint {
|
||||
@Override
|
||||
public boolean canBePlaced(final Sudoku s, int x, int y, int newSymbolIndex) {
|
||||
for (int i = 0; i < s.getSize(); i++) {
|
||||
if (s.getCase(newSymbolIndex, y).getSymboleIndex() == newSymbolIndex)
|
||||
if (s.getCell(newSymbolIndex, y).getSymboleIndex() == newSymbolIndex)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user