This commit is contained in:
16
app/src/main/java/sudoku/constraint/ColumnConstraint.java
Normal file
16
app/src/main/java/sudoku/constraint/ColumnConstraint.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package sudoku.constraint;
|
||||
|
||||
import sudoku.Sudoku;
|
||||
|
||||
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)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user