diff options
author | sanine <sanine.not@pm.me> | 2023-11-11 15:04:36 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-11-11 15:04:36 -0600 |
commit | f7b0ed22b2fd0ddafc4a84dde1ad8e3208144844 (patch) | |
tree | e290cda13f58eb9a2e3cf2e5e7b05748a0c8e982 /src/simulation/lattice_rules.js | |
parent | c2466a35fb1edce6088b72df17444631f7034e07 (diff) |
gol changes make sound
Diffstat (limited to 'src/simulation/lattice_rules.js')
-rw-r--r-- | src/simulation/lattice_rules.js | 13 |
1 files changed, 10 insertions, 3 deletions
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; } }, |