A Go version of the https://lcthw.dev/learn-code-the-hard-way/curseyou-python-rogue that makes a tiny Rogue in Go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
510 B

--- 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 &&