summaryrefslogtreecommitdiff
path: root/src/simulation/postprocess.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-11-11 13:58:56 -0600
committersanine <sanine.not@pm.me>2023-11-11 13:58:56 -0600
commit78f2f5f4b1ccd58bbdef0d5e5d2dd026ac4ad668 (patch)
tree25e4fdad001cdcf7ca5bd1055591b84441a97d75 /src/simulation/postprocess.js
parent7a3fc898def0283ed6655b5c45a5f413638272a7 (diff)
add postprocessing rule to freeze agents
Diffstat (limited to 'src/simulation/postprocess.js')
-rw-r--r--src/simulation/postprocess.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/simulation/postprocess.js b/src/simulation/postprocess.js
new file mode 100644
index 0000000..d50839e
--- /dev/null
+++ b/src/simulation/postprocess.js
@@ -0,0 +1,18 @@
+'use strict';
+
+export const postprocess = [
+ (world) => ({
+ ...world,
+ agents: world.agents.map(a => {
+ const {x, y} = a;
+ if (
+ world.lattice[y][x].type === 'mutable' ||
+ world.lattice[y][x].type === 'active'
+ ) {
+ return { ...a, flags: {...a.flags, frozen: true } };
+ } else {
+ return a;
+ }
+ }),
+ }),
+];