~smlavine/mazesolver

647d55210c7c544a4f52a549cbd96b3bfd86e508 — Sebastian LaVine 2 years ago b467817
Set start to ROUTE before looping through predecessors

It is more clear to start with a special case `steps = 1` than to end
with a special case `steps++`.
1 files changed, 2 insertions(+), 2 deletions(-)

M mazesolver.go
M mazesolver.go => mazesolver.go +2 -2
@@ 156,12 156,12 @@ func (maze *Maze) Solve() (steps uint) {
		return
	}

	start.char = ROUTE
	steps = 1
	for t := end; t != start; t = predecessors[t] {
		t.char = ROUTE
		steps++
	}
	start.char = ROUTE
	steps++

	return
}