From f7b0ed22b2fd0ddafc4a84dde1ad8e3208144844 Mon Sep 17 00:00:00 2001 From: sanine Date: Sat, 11 Nov 2023 15:04:36 -0600 Subject: gol changes make sound --- src/simulation/lattice_rules.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/simulation/lattice_rules.js') diff --git a/src/simulation/lattice_rules.js b/src/simulation/lattice_rules.js index 0f46d0d..db027a3 100644 --- a/src/simulation/lattice_rules.js +++ b/src/simulation/lattice_rules.js @@ -30,7 +30,10 @@ export const lattice_rules = { .filter(type => type === 'mutable' || type === 'active') .length; if (num_active_neighbors === 3) { - return { world_updates: [{ x, y, from: 'empty', to: 'active' }] }; + return { world_updates: [{ + x, y, from: 'empty', to: 'active', + flags: { emit: [0, 0, 0, 0, 0, 0, 0, 1] }, + }]}; } }, @@ -39,10 +42,14 @@ export const lattice_rules = { .map(([x, y, cell]) => cell.type) .filter(type => type === 'mutable' || type === 'active') .length; + const die = { world_updates: [{ + x, y, from: 'active', to: 'empty', + flags: { emit: [0, 0, 0, 0, 0, 0, 0, -1] }, + }]}; if (num_active_neighbors < 2) { - return { world_updates: [{ x, y, from: 'active', to: 'empty' }] }; + return die; } else if (num_active_neighbors > 3) { - return { world_updates: [{ x, y, from: 'active', to: 'empty' }] }; + return die; } }, -- cgit v1.2.1