44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package logic
|
|
|
|
import "git.kleiax.de/homepage/libs/sudoku/board"
|
|
|
|
// ────────────────────────────────────────────────────────────────────────────── //
|
|
// SOLVER STRUCTURE //
|
|
// ────────────────────────────────────────────────────────────────────────────── //
|
|
|
|
type Solver struct {
|
|
strategies []Strategy
|
|
conf struct {
|
|
all bool
|
|
repeat bool
|
|
}
|
|
}
|
|
|
|
func (s *Solver) Add(strategy Strategy) {
|
|
s.strategies = append(s.strategies, strategy)
|
|
}
|
|
|
|
func (s *Solver) initStragies(field *board.Field) {
|
|
for _, strategy := range s.strategies {
|
|
strategy.Init(field)
|
|
}
|
|
}
|
|
|
|
func (s *Solver) run(i int) bool {
|
|
//TODO: clean und Fehlerauffangen
|
|
s.strategies[i].SearchProgressableCells()
|
|
numberOfChanges := s.strategies[i].ApplyAll()
|
|
if numberOfChanges == 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (s *Solver) search() {
|
|
|
|
}
|
|
|
|
func (s *Solver) getSolutionPath() []board.Change {
|
|
return nil
|
|
}
|