diff --git a/maze.go b/maze.go index a00ff60..2400221 100644 --- a/maze.go +++ b/maze.go @@ -231,21 +231,20 @@ func (maze *Maze) Undo() { if point.Equal(next) { // Previous point was not found (for example: the start point) break - } else { - // Move backward - point = next - // If there's another path which has not been visited, stop the procedure - count := 0 - for _, direction := range Directions { - if maze.Directions[next.X][next.Y]&direction != 0 { - count++ - } - } - // The path we came from, we visited once and another - if count > 2 { - break + } + // Move backward + point = next + // If there's another path which has not been visited, stop the procedure + count := 0 + for _, direction := range Directions { + if maze.Directions[next.X][next.Y]&direction != 0 { + count++ } } + // The path we came from, we visited once and another + if count > 2 { + break + } } // Move back the cursor maze.Cursor = point