Skip to content

Commit

Permalink
error fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
morenomarcus03 committed Feb 27, 2024
1 parent eb1024b commit db63375
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
ThermometerBoard grid = (ThermometerBoard) board;
ThermometerCell cell = (ThermometerCell) grid.getPuzzleElement(puzzleElement);
int blocked = 0;
for(int i = 0; i < grid.getHeight(cell.getLocation().getX()); i++){
for(int i = 0; i < grid.getHeight(); i++){
if(grid.getCell((int)cell.getLocation().getX(), i).getFill() == ThermometerFill.BLOCKED){ blocked++;}
}
if(grid.getRowNumber(cell.getLocation().getX()) > blocked) return null;
if(grid.getRowNumber((int)cell.getLocation().getX()) > blocked) return null;

blocked = 0;
for(int i = 0; i < grid.getColumn(cell.getLocation().getY()); i++){
for(int i = 0; i < grid.getWidth(); i++){
if(grid.getCell(i, (int)cell.getLocation().getY()).getFill() == ThermometerFill.BLOCKED){ blocked++;}
}
if(grid.getColumnNumber(cell.getLocation().getY()) > blocked) return null;
if(grid.getColNumber((int)cell.getLocation().getY()) > blocked) return null;

return Invalid_Use_Message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
ThermometerBoard grid = (ThermometerBoard) board;
ThermometerCell cell = (ThermometerCell) grid.getPuzzleElement(puzzleElement);
int filled = 0;
for(int i = 0; i < grid.getHeight(cell.getLocation().getX()); i++){
for(int i = 0; i < grid.getHeight(); i++){
if(grid.getCell((int)cell.getLocation().getX(), i).getFill() == ThermometerFill.FILLED){ filled++;}
}
if(grid.getRowNumber(cell.getLocation().getX()) > filled) return null;
if(grid.getRowNumber((int)cell.getLocation().getX()) > filled) return null;

filled = 0;
for(int i = 0; i < grid.getColumn(cell.getLocation().getY()); i++){
for(int i = 0; i < grid.getWidth(); i++){
if(grid.getCell(i, (int)cell.getLocation().getY()).getFill() == ThermometerFill.FILLED){ filled++;}
}
if(grid.getColumnNumber(cell.getLocation().getY()) > filled) return null;
if(grid.getColNumber((int)cell.getLocation().getY()) > filled) return null;

return Invalid_Use_Message;
}
Expand Down

0 comments on commit db63375

Please sign in to comment.