fix merge
All checks were successful
Linux arm64 / Build (push) Successful in 43s

This commit is contained in:
2025-01-21 18:47:09 +01:00
parent 1594961613
commit 780c88d0da
5 changed files with 14 additions and 12 deletions

View File

@@ -1,7 +1,5 @@
package sudoku;
import com.fasterxml.jackson.annotation.JsonProperty;
public abstract class Cell {
protected static int NOSYMBOLE = -1;
@@ -32,11 +30,8 @@ public abstract class Cell {
this.block = block;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof Cell otherCell)
return otherCell.getSymbolIndex() == this.getSymbolIndex();
return false;
public boolean equalsValue(Cell otherCell) {
return otherCell.getSymbolIndex() == this.getSymbolIndex();
}
@Override

View File

@@ -18,7 +18,7 @@ public class Sudoku {
public Sudoku(List<Cell> cells, List<Block> blocks, List<IConstraint> constraints) {
this.cells = cells;
this.blocks = blocks;
this.constraints = new ArrayList<>(constraints);
this.constraints = constraints;
}
public Cell getCell(int x, int y) {
@@ -45,6 +45,14 @@ public class Sudoku {
throw new Error("Function isValid() not implemented");
}
public List<Cell> getCells() {
return this.cells;
}
public List<Block> getBlocks() {
return this.blocks;
}
public List<MutableCell> getMutableCells() {
List<MutableCell> mutableCells = new ArrayList<>();
for (Cell cell : this.cells) {

View File

@@ -11,7 +11,7 @@ public class SudokuPrinter {
}
String line = "[ ";
for (int x = 0; x < s.getSize(); x++) {
line += (s.getCell(x, y).getSymboleIndex() + 1) + " ";
line += (s.getCell(x, y).getSymbolIndex() + 1) + " ";
if (x % blockWidth == blockWidth - 1 && x != blockWidth * blockHeight - 1) {
line += "| ";
}

View File

@@ -43,7 +43,7 @@ public class SudokuSerializer {
}
int blockID = blockIds.indexOf(block);
int symboleIndex = cell.getSymboleIndex();
int symboleIndex = cell.getSymbolIndex();
JSONObject cellJsonObject = new JSONObject();
cellJsonObject.put("blockID", blockID);
@@ -157,7 +157,7 @@ public class SudokuSerializer {
sudokuBlocks.add(blocks.get(blockID));
}
sudokus.add(new Sudoku(sudokuCells, sudokuBlocks));
sudokus.add(new Sudoku(sudokuCells, sudokuBlocks, null));
}
return new MultiDoku(sudokus);

View File

@@ -1,6 +1,5 @@
package sudoku;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;