From c7fb1894be9e13b5a5e6b4cf19b542f9b070e999 Mon Sep 17 00:00:00 2001 From: Paul Buxton Date: Sun, 9 Nov 2025 09:13:02 +0000 Subject: [PATCH 1/2] Fix boundaries in test harness --- .../output_harness/src/map_builder/automata.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MoreInterestingDungeons/output_harness/src/map_builder/automata.rs b/MoreInterestingDungeons/output_harness/src/map_builder/automata.rs index c173606..794b0e5 100644 --- a/MoreInterestingDungeons/output_harness/src/map_builder/automata.rs +++ b/MoreInterestingDungeons/output_harness/src/map_builder/automata.rs @@ -85,10 +85,12 @@ impl CellularAutomataArchitect { for x in 1 .. SCREEN_WIDTH { self.map.tiles[map_idx(x, 1)] = TileType::Wall; self.map.tiles[map_idx(x, SCREEN_HEIGHT-1)] = TileType::Wall; + self.map.tiles[map_idx(x, 0)] = TileType::Wall; } for y in 1 .. SCREEN_HEIGHT { self.map.tiles[map_idx(1, y)] = TileType::Wall; self.map.tiles[map_idx(SCREEN_WIDTH-1, y)] = TileType::Wall; + self.map.tiles[map_idx(0, y)] = TileType::Wall; } } From 306d5a8635d71b6e4db65cf4af5b4e4146b892ab Mon Sep 17 00:00:00 2001 From: Paul Buxton Date: Sun, 9 Nov 2025 09:47:35 +0000 Subject: [PATCH 2/2] Add boundaries to cellular automata --- .../cellular/src/map_builder/automata.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/MoreInterestingDungeons/cellular/src/map_builder/automata.rs b/MoreInterestingDungeons/cellular/src/map_builder/automata.rs index 1c21dac..d22ac70 100644 --- a/MoreInterestingDungeons/cellular/src/map_builder/automata.rs +++ b/MoreInterestingDungeons/cellular/src/map_builder/automata.rs @@ -16,6 +16,7 @@ impl MapArchitect for CellularAutomataArchitect { for _ in 0..10 { self.iteration(&mut mb.map); } + self.add_boundaries(&mut mb.map); let start = self.find_start(&mb.map); mb.monster_spawns = mb.spawn_monsters(&start, rng); mb.player_start = start; @@ -71,6 +72,19 @@ impl CellularAutomataArchitect { map.tiles = new_tiles; } + fn add_boundaries(&mut self, map: &mut Map) { + for x in 1 .. SCREEN_WIDTH { + map.tiles[map_idx(x, 1)] = TileType::Wall; + map.tiles[map_idx(x, SCREEN_HEIGHT-1)] = TileType::Wall; + map.tiles[map_idx(x, 0)] = TileType::Wall; + } + for y in 1 .. SCREEN_HEIGHT { + map.tiles[map_idx(1, y)] = TileType::Wall; + map.tiles[map_idx(SCREEN_WIDTH-1, y)] = TileType::Wall; + map.tiles[map_idx(0, y)] = TileType::Wall; + } + } + fn find_start(&self, map: &Map) -> Point { let center = Point::new(SCREEN_WIDTH/2, SCREEN_HEIGHT/2);// (10) let closest_point = map.tiles