From 7854244c0318f590e0f198ec72dfd55afdd1bc91 Mon Sep 17 00:00:00 2001 From: MetroWind Date: Sun, 31 Aug 2025 22:07:18 -0700 Subject: Correctly initialize the plan array. Similar to python, filling the array with an array just create references. We need actual copies. --- scripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/main.js b/scripts/main.js index 8df176b..8f3bbee 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -1,6 +1,6 @@ const DEFAULT_APP_STATE = { floor: 0, // This is 0-based. - plan: new Array(FLOOR_COUNT).fill( + plan: new Array(FLOOR_COUNT).fill(null).map(() => new Array(GRID_SIZE_X * GRID_SIZE_Y).fill(0)), // mouse_state can be “normal”, or “dnd”. mouse_state: "normal", -- cgit v1.2.3-70-g09d2