From 70b762b2cebff56ce2db325604182f54ccff0933 Mon Sep 17 00:00:00 2001 From: m Date: Sun, 23 Jul 2023 15:41:01 -0400 Subject: [PATCH] Some corrections to cellular automata generation --- scripts/algorithms/cellular_auotmata.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/algorithms/cellular_auotmata.lua b/scripts/algorithms/cellular_auotmata.lua index 5eb8fdf..ea428ce 100644 --- a/scripts/algorithms/cellular_auotmata.lua +++ b/scripts/algorithms/cellular_auotmata.lua @@ -46,7 +46,8 @@ function CellularAutomata:update() for mx = 0, self.map_w - 1 do for my = 0, self.map_h - 1 do local neighbors = self.get_neighbors(old_map, mx, my) - local walls = 0 + local expected_neighbors = 9 + local walls = expected_neighbors - #neighbors local required_walls = 5 --print(old_map:is_wall(mx, my)) --print(new_map:is_wall(mx, my))