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:
Karma Riuk 2023-08-05 11:25:32 +02:00
parent fccfde890a
commit 5445d28b2c
2 changed files with 28 additions and 27 deletions

View File

@ -1,10 +1,5 @@
package maze package maze
import (
"fmt"
"strings"
)
type Coordinates struct { type Coordinates struct {
X, Y int 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 { type Maze struct {
Width, Height uint Width, Height uint
Nodes []*Node Nodes []*Node

28
maze/raw_maze.go Normal file
View 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()
}