|
|
|
@ -13,18 +13,6 @@ func compass(near Position, offset int) []Position { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (game *Game) CloneMap() Map { |
|
|
|
|
// this is a shallow copy though
|
|
|
|
|
new_map := slices.Clone(game.Level) |
|
|
|
|
|
|
|
|
|
for i, row := range new_map { |
|
|
|
|
// this makes sure the row is an actual copy
|
|
|
|
|
new_map[i] = slices.Clone(row) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return new_map |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (game *Game) Inbounds(pos Position, offset int) bool { |
|
|
|
|
return pos.X >= offset && |
|
|
|
|
pos.X < game.Width - offset && |
|
|
|
|