summaryrefslogtreecommitdiff
path: root/src/simulation/postprocess.js
blob: d50839ec7d2443dd1a960f307df63d75bcfa7d0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;
      }
    }),
  }),
];