31 lines
405 B
Go
31 lines
405 B
Go
package solver
|
|
|
|
import (
|
|
"fmt"
|
|
"maze-solver/maze"
|
|
)
|
|
|
|
type Solver interface {
|
|
Solve(*maze.Maze) *maze.SolvedMaze
|
|
}
|
|
|
|
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:
|
|
return &TurnLeftSolver{}
|
|
}
|
|
panic(fmt.Sprintf("Unrecognized solver type %q", *f.Type))
|
|
}
|