~smlavine/mazesolver

f4ec1fc6eec3748a0fd2331397a3a900f6025674 — Sebastian LaVine 2 years ago bd8adf6
Fix bad col assignment bug

With the range, col would be the column of the line of text, not of the
maze. Silly mistake.
1 files changed, 3 insertions(+), 1 deletions(-)

M mazesolver.go
M mazesolver.go => mazesolver.go +3 -1
@@ 54,7 54,8 @@ func NewMaze(r io.Reader) *Maze {
	scanner := bufio.NewScanner(r)
	for scanner.Scan() {
		row := make([]Tile, 0)
		for col, char := range scanner.Text() {
		col := 0
		for _, char := range scanner.Text() {
			var t rune
			switch char {
			case '0':


@@ 69,6 70,7 @@ func NewMaze(r io.Reader) *Maze {
				row:  maze.rows,
				col:  col,
			})
			col++
		}
		maze.grid = append(maze.grid, row)
		maze.rows++