From 235814a418e26497faa21aa35bf987b52abd9970 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Wed, 9 Aug 2023 17:41:44 +0200 Subject: [PATCH] Added description comments --- io/writer/strings.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/io/writer/strings.go b/io/writer/strings.go index be11f4e..cab5510 100644 --- a/io/writer/strings.go +++ b/io/writer/strings.go @@ -15,9 +15,13 @@ type StringsWriter struct { func (w *StringsWriter) Write() error { w.lines = make([][]byte, w.Maze.Height) + + // Fill the lines with walls for y := 0; y < w.Maze.Height; y++ { w.lines[y] = bytes.Repeat([]byte{w.WallChar}, w.Maze.Width) } + + // Fill in the paths for _, node := range w.Maze.Nodes { if node.Right != nil { w.fillHorizontally(node.Coords, node.Right.Coords, w.PathChar) @@ -27,6 +31,7 @@ func (w *StringsWriter) Write() error { } } + // Fill in the solution for i := 0; i < len(w.Maze.Solution)-1; i++ { current := w.Maze.Solution[i].Coords next := w.Maze.Solution[i+1].Coords