Files
Sudoku/logic/strategies/divers.go
T

56 lines
2.5 KiB
Go

package strategies
import "git.kleiax.de/homepage/board"
// ────────────────────────────────────────────────────────────────────────────── //
// LAST_DIGIT STRUCTURE //
// ────────────────────────────────────────────────────────────────────────────── //
type LastDigit struct {
Base
}
func (ld *LastDigit) SearchProgressableCells() int {
ld.field.ForEachPart(func(part board.Part) {
missingNumbers := part.GetMissingNumbers()
if len(missingNumbers) == 1 {
var emptyCell *board.Cell
part.ForEachCell(func(cell *board.Cell) {
if cell.GetNumber() == 0 {
emptyCell = cell
}
})
change := board.ExternalChange{
Cell: emptyCell,
Action: board.ActionSetNumber,
Value: missingNumbers[0],
From: emptyCell.GetNumber(),
TriggerdBy: ld.getName(),
}
ld.changes = append(ld.changes, change)
}
})
//fmt.Printf("LastDigit Changes %d", len(ld.changes))
return len(ld.changes)
}
func (ld *LastDigit) getName() string {
return "Last Digit - Letzte Zahl"
}
// ────────────────────────────────────────────────────────────────────────────── //
// CRP STRUCTURE //
// ────────────────────────────────────────────────────────────────────────────── //
type CRP struct {
Base
}
// ────────────────────────────────────────────────────────────────────────────── //
// SIMPLE_COLORING_T1 STRUCTURE //
// ────────────────────────────────────────────────────────────────────────────── //
type SimpleColoringT1 struct {
Base
}