Files

60 lines
2.7 KiB
Go

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