Added argument parsing to run the solver correctly

This commit is contained in:
Karma Riuk
2023-08-11 12:30:37 +02:00
parent e5840321e2
commit d28c118102
7 changed files with 248 additions and 9 deletions

View File

@ -1,7 +1,30 @@
package solver
import "maze-solver/maze"
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))
}