Refactor Sudoku field and solver implementation

This commit is contained in:
2026-09-16 22:52:44 +02:00
parent 8a5ae8c640
commit f7f9c16184
24 changed files with 1574 additions and 603 deletions
+10 -4
View File
@@ -17,13 +17,16 @@ func (ld *LastDigit) SearchProgressableCells() int {
missingNumbers := part.GetMissingNumbers()
if len(missingNumbers) == 1 {
var emptyCell *field.Cell
emptyCount := 0
part.ForEachCell(func(cell *field.Cell) {
if cell.GetNumber() == 0 {
emptyCell = cell
emptyCount++
}
})
// fmt.Println(part)
// fmt.Printf("Gefundene Zelle: %d/%d - %d, missungNumber: %v, Typ: %T\n", emptyCell.Pos.GetRow(), emptyCell.Pos.GetColumn(), emptyCell.GetNumber(), missingNumbers, part)
if emptyCount != 1 {
return
}
change := field.ExternalChange{
Cell: emptyCell,
Action: field.ActionSetNumber,
@@ -31,10 +34,9 @@ func (ld *LastDigit) SearchProgressableCells() int {
From: emptyCell.GetNumber(),
TriggerdBy: ld.getName(),
}
ld.changes = append(ld.changes, change)
ld.queue(change)
}
})
// fmt.Printf("LastDigit Changes %d\n", len(ld.changes))
return len(ld.changes)
}
@@ -42,6 +44,10 @@ func (ld *LastDigit) getName() string {
return "Last Digit"
}
func (ld *LastDigit) Name() string {
return ld.getName()
}
// ────────────────────────────────────────────────────────────────────────────── //
// CRP STRUCTURE //
// ────────────────────────────────────────────────────────────────────────────── //