2023-08-03 21:07:58 +02:00
|
|
|
package solver
|
|
|
|
|
2023-08-11 12:30:37 +02:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"maze-solver/maze"
|
|
|
|
)
|
2023-08-03 21:07:58 +02:00
|
|
|
|
|
|
|
type Solver interface {
|
|
|
|
Solve(*maze.Maze) *maze.SolvedMaze
|
|
|
|
}
|
2023-08-11 12:30:37 +02:00
|
|
|
|
|
|
|
type SolverFactory struct {
|
|
|
|
Type *string
|
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
|
|
|
_TURN_LEFT = "turn-left"
|
|
|
|
)
|
|
|
|
|
|
|
|
var TYPES = []string{
|
|
|
|
_TURN_LEFT,
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *SolverFactory) Get() Solver {
|
|
|
|
switch *f.Type {
|
|
|
|
case _TURN_LEFT:
|
2023-08-13 21:31:47 +02:00
|
|
|
return &DFSSolver{}
|
2023-08-11 12:30:37 +02:00
|
|
|
}
|
|
|
|
panic(fmt.Sprintf("Unrecognized solver type %q", *f.Type))
|
|
|
|
}
|