Reader -> Reader+Parser refactoring: main.go now

uses the new structure
This commit is contained in:
Karma Riuk 2023-08-05 12:01:29 +02:00
parent 5445d28b2c
commit 0bee145c8e

View File

@ -3,21 +3,21 @@ package main
import ( import (
"maze-solver/io/reader" "maze-solver/io/reader"
"maze-solver/io/writer" "maze-solver/io/writer"
"maze-solver/maze/parser"
"maze-solver/solver" "maze-solver/solver"
"maze-solver/utils" "maze-solver/utils"
) )
func main() { func main() {
input := "filename"
output := "filename" output := "filename"
reader := &reader.TextReader{PathChar: ' ', WallChar: '#'} reader := &reader.TextReader{Filename: "filename", PathChar: ' ', WallChar: '#'}
writer := &writer.ImageWriter{} writer := &writer.ImageWriter{}
solver := &solver.Bfs{} solver := &solver.Bfs{}
maze, err := reader.Read(input) maze, err := parser.Parse(reader)
utils.Check(err, "Couldn't read maze from %q", input) utils.Check(err, "Couldn't read maze from %q", reader.Filename)
solved := solver.Solve(maze) solved := solver.Solve(maze)
err = writer.Write(output, solved) err = writer.Write(output, solved)