From 5445d28b2c7edbc80e596b297635c5197be9d018 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Sat, 5 Aug 2023 11:25:32 +0200 Subject: [PATCH] Moved RaMaze to its own file, cuz we gonna need some more functions and it would just clutter maze.go --- maze/maze.go | 27 --------------------------- maze/raw_maze.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 27 deletions(-) create mode 100644 maze/raw_maze.go diff --git a/maze/maze.go b/maze/maze.go index 3cb708a..471e361 100644 --- a/maze/maze.go +++ b/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 diff --git a/maze/raw_maze.go b/maze/raw_maze.go new file mode 100644 index 0000000..78d57c8 --- /dev/null +++ b/maze/raw_maze.go @@ -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() +}