Changed type of maze in SolvedMaze to pointer, to
not copy the entire maze by value
This commit is contained in:
parent
99fc6ba48a
commit
0f05998295
@ -13,7 +13,6 @@ func trivial() *maze.SolvedMaze {
|
||||
#123#
|
||||
###4#
|
||||
*/
|
||||
ret := &maze.SolvedMaze{}
|
||||
nodes := make([]*maze.Node, 5)
|
||||
|
||||
nodes[0] = maze.NewNode(maze.Coordinates{X: 2, Y: 0})
|
||||
@ -37,16 +36,17 @@ func trivial() *maze.SolvedMaze {
|
||||
|
||||
nodes[4].Up = nodes[3]
|
||||
|
||||
solution := []*maze.Node{
|
||||
nodes[0], nodes[2], nodes[3], nodes[4],
|
||||
ret := &maze.SolvedMaze{
|
||||
Maze: &maze.Maze{
|
||||
Width: 5,
|
||||
Height: 3,
|
||||
Nodes: nodes,
|
||||
},
|
||||
Solution: []*maze.Node{
|
||||
nodes[0], nodes[2], nodes[3], nodes[4],
|
||||
},
|
||||
}
|
||||
|
||||
ret.Nodes = nodes
|
||||
ret.Width = 5
|
||||
ret.Height = 3
|
||||
|
||||
ret.Solution = solution
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ func bigger() *maze.SolvedMaze {
|
||||
nodes[4].Up = nodes[3]
|
||||
|
||||
ret := &maze.SolvedMaze{
|
||||
Maze: maze.Maze{
|
||||
Maze: &maze.Maze{
|
||||
Width: 7,
|
||||
Height: 5,
|
||||
Nodes: nodes,
|
||||
@ -146,7 +146,7 @@ func bigger_staggered() *maze.SolvedMaze {
|
||||
nodes[5].Up = nodes[4]
|
||||
|
||||
ret := &maze.SolvedMaze{
|
||||
Maze: maze.Maze{
|
||||
Maze: &maze.Maze{
|
||||
Width: 7,
|
||||
Height: 5,
|
||||
Nodes: nodes,
|
||||
@ -266,7 +266,7 @@ func normal() *maze.SolvedMaze {
|
||||
}
|
||||
|
||||
ret := &maze.SolvedMaze{
|
||||
Maze: maze.Maze{
|
||||
Maze: &maze.Maze{
|
||||
Width: 11,
|
||||
Height: 11,
|
||||
Nodes: nodes,
|
||||
|
@ -48,6 +48,6 @@ type Maze struct {
|
||||
}
|
||||
|
||||
type SolvedMaze struct {
|
||||
Maze
|
||||
*Maze
|
||||
Solution []*Node
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user