47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
package logic
|
|
|
|
import (
|
|
"git.kleiax.de/homepage/board"
|
|
"git.kleiax.de/homepage/logic/strategies"
|
|
)
|
|
|
|
// ────────────────────────────────────────────────────────────────────────────── //
|
|
// SOLVER STRUCTURE //
|
|
// ────────────────────────────────────────────────────────────────────────────── //
|
|
|
|
type Solver struct {
|
|
strategies []strategies.Strategy
|
|
conf struct {
|
|
all bool
|
|
repeat bool
|
|
}
|
|
}
|
|
|
|
func (s *Solver) Add(strategy strategies.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.ExternalChange {
|
|
return nil
|
|
}
|