This commit is contained in:
@@ -17,11 +17,6 @@ public class MutableCell extends Cell{
|
||||
this.possibleSymbols = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MutableCell(MutableCell currentCell) {
|
||||
super(currentCell);
|
||||
this.possibleSymbols = currentCell.getPossibleSymbols();
|
||||
}
|
||||
|
||||
public void setSymbolIndex(int symbolIndex) {
|
||||
this.symbolIndex = symbolIndex;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,10 @@ public class SudokuFactory {
|
||||
for (int x = 0; x < width; x++) {
|
||||
int index = ((y + blockY * height) * size + (x + blockX * width));
|
||||
Cell blockCell = cells.get(index);
|
||||
List<Block> blockContainers = new ArrayList<>();
|
||||
blockContainers.add(newBlock);
|
||||
blockCell.setBlockContainers(blockContainers);
|
||||
blockCell.setBlock(newBlock);
|
||||
// List<Block> blockContainers = new ArrayList<>();
|
||||
// blockContainers.add(newBlock);
|
||||
// blockCell.setBlockContainers(blockContainers);
|
||||
newBlock.addCell(blockCell);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Solver {
|
||||
|
||||
int symbol = currentCell.getPossibleSymbols().get(0);
|
||||
currentCell.setSymbolIndex(symbol);
|
||||
stack.push(new MutableCell(currentCell));
|
||||
// stack.push(new MutableCell(currentCell));
|
||||
try {
|
||||
doku.updateSymbolsPossibilities();
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -2,6 +2,8 @@ package sudoku;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import sudoku.io.SudokuPrinter;
|
||||
@@ -19,9 +21,13 @@ public class SudokuSerializerTest {
|
||||
|
||||
@Test
|
||||
void testSerialize() {
|
||||
int blockWidth = 3;
|
||||
int blockHeight = 3;
|
||||
int testCount = 5;
|
||||
Random r = new Random();
|
||||
for (int i = 0; i < testCount; i++) {
|
||||
int blockWidth = r.nextInt(20) + 1;
|
||||
int blockHeight = r.nextInt(20) + 1;
|
||||
testSerializeWithSize(blockWidth, blockHeight);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user