Merge pull request 'Fixes #15' (#36) from multiplayer into master
All checks were successful
Linux arm64 / Build (push) Successful in 39s

Reviewed-on: #36
This commit was merged in pull request #36.
This commit is contained in:
2025-02-01 12:43:13 +00:00
29 changed files with 653 additions and 55 deletions

View File

@@ -126,6 +126,8 @@ public class Cell {
}
public boolean trySetValue(int newValue) {
if (!isMutable())
return false;
if (!canHaveValue(newValue))
return false;
setSymbolIndex(newValue);

View File

@@ -1,6 +1,10 @@
package sudoku.structure;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import sudoku.io.SudokuSerializer;
@@ -178,4 +182,18 @@ public class MultiDoku {
int randomIndex = rand.nextInt(emptyCells.size());
return emptyCells.get(randomIndex);
}
public void clearMutableCells() {
for (Sudoku s : getSubGrids()) {
for (Cell cell : s.getCells()) {
if (cell.isMutable())
cell.clearCurrentSymbol();
}
}
}
public MultiDoku clone() {
//TODO: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah
return SudokuSerializer.deserializeSudoku(SudokuSerializer.serializeSudoku(this));
}
}