Source File: curse-you-go-rogue/03_pathing_enemies/map.go.diff
--- 02_mazes_and_enemies/map.go 2025-10-06 23:33:02.887088700 -0400
+++ 03_pathing_enemies/map.go 2025-10-06 10:44:52.350308600 -0400
@@ -14,4 +14,16 @@
}
+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 &&