Added String() method to RawMaze for debugging

purposes
This commit is contained in:
Karma Riuk 2023-08-05 11:20:53 +02:00
parent 221bcf2695
commit 19ab3c9cf3

View File

@ -1,5 +1,10 @@
package maze
import (
"fmt"
"strings"
)
type Coordinates struct {
X, Y int
}
@ -24,6 +29,23 @@ type RawMaze struct {
Data []string
}
func (m *RawMaze) String() string {
var ret strings.Builder
ret.WriteString("{\n")
ret.WriteString(fmt.Sprintf("\tPathChar: %v,\n", m.PathChar))
ret.WriteString(fmt.Sprintf("\tWallChar: %v,\n", m.WallChar))
ret.WriteString("\tData: \n")
for _, line := range m.Data {
ret.WriteRune('\t')
ret.WriteRune('\t')
ret.WriteString(line)
ret.WriteRune('\n')
}
ret.WriteString("}")
return ret.String()
}
type Maze struct {
Width, Height uint
Nodes []*Node