No need to have CloneMap yet.

master
Zed A. Shaw 2 days ago
parent 202a6ab692
commit d75dd78e3b
  1. 12
      01_the_screen/map.go
  2. 12
      02_mazes_and_enemies/map.go

@ -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 { func (game *Game) Inbounds(pos Position, offset int) bool {
return pos.X >= offset && return pos.X >= offset &&
pos.X < game.Width - offset && pos.X < game.Width - offset &&

@ -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 { func (game *Game) Inbounds(pos Position, offset int) bool {
return pos.X >= offset && return pos.X >= offset &&
pos.X < game.Width - offset && pos.X < game.Width - offset &&

Loading…
Cancel
Save