Added String() method to RawMaze for debugging
purposes
This commit is contained in:
parent
929c5b58a0
commit
435ea54343
22
maze/maze.go
22
maze/maze.go
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user