summaryrefslogtreecommitdiff
path: root/src/simulation/lattice_rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulation/lattice_rules.js')
-rw-r--r--src/simulation/lattice_rules.js13
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;
}
},