summaryrefslogtreecommitdiff
path: root/src/world/agent.test.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-11-16 14:50:00 -0600
committersanine <sanine.not@pm.me>2023-11-16 14:50:00 -0600
commitf9fc4d26ec5fca9ee175c8a6fbcdd0fa36f10947 (patch)
treef190e6e465bb563c608a916f41fc8bf686ea2897 /src/world/agent.test.js
parent7825b92ce3be95a0ce1dfea9388adbaadce83b1f (diff)
clear out js files
Diffstat (limited to 'src/world/agent.test.js')
-rw-r--r--src/world/agent.test.js49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/world/agent.test.js b/src/world/agent.test.js
deleted file mode 100644
index d10a43a..0000000
--- a/src/world/agent.test.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import { agent_decide, agent_apply } from './agent.js';
-
-
-test("simple agent decisions", () => {
- const lattice = null;
- const agent = {
- id: 3,
- net: { compute: () => [[0, 1], 'state'] },
- state: null,
- x: 0, y: 0,
- flags: {},
- };
-
- const senses = [];
- const actions = [
- { size: 1, propose: (world, agent, head) => [{ agent_changes: [{ agent_id: 3, flags: { act1: head[0] } }] }] },
- { size: 1, propose: (world, agent, head) => [{ agent_changes: [{ agent_id: 3, flags: { act2: head[0] } }] }] },
- ];
-
- expect(agent_decide(lattice, agent, senses, actions)).toEqual([
- { ...agent, state: 'state' },
- actions.map((a, idx) => a.propose(null, null, [idx])).flat(),
- ]);
-});
-
-
-test("apply proposals to agent", () => {
- const props = [
- { agent_changes: [{ agent_id: 14, x: 4, y: 3 }] },
- { agent_changes: [{ agent_id: 16, x: 5, y: 3 }] },
- { agent_changes: [{ agent_id: 14, flags: { frozen: true } }] },
- ];
-
- const agent = {
- id: 14,
- net: null,
- state: null,
- x: 0, y: 0,
- flags: { frozen: false, emit: 6 }
- };
-
- expect(agent_apply(agent, props)).toEqual({
- id: 14,
- net: null,
- state: null,
- x: 4, y: 3,
- flags: { frozen: true, emit: 6 }
- });
-});