Moved RaMaze to its own file, cuz we gonna need
some more functions and it would just clutter maze.go
This commit is contained in:
parent
fccfde890a
commit
5445d28b2c
27
maze/maze.go
27
maze/maze.go
@ -1,10 +1,5 @@
|
||||
package maze
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Coordinates struct {
|
||||
X, Y int
|
||||
}
|
||||
@ -24,28 +19,6 @@ func NewNode(coords Coordinates) *Node {
|
||||
}
|
||||
}
|
||||
|
||||
type RawMaze struct {
|
||||
PathChar, WallChar byte
|
||||
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
|
||||
|
28
maze/raw_maze.go
Normal file
28
maze/raw_maze.go
Normal file
@ -0,0 +1,28 @@
|
||||
package maze
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type RawMaze struct {
|
||||
PathChar, WallChar byte
|
||||
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()
|
||||
}
|
Loading…
Reference in New Issue
Block a user