summaryrefslogtreecommitdiff
path: root/src/world
diff options
context:
space:
mode:
Diffstat (limited to 'src/world')
-rw-r--r--src/world/agent.js2
-rw-r--r--src/world/agent.test.js6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/world/agent.js b/src/world/agent.js
index 576ebc4..3faa3c8 100644
--- a/src/world/agent.js
+++ b/src/world/agent.js
@@ -15,7 +15,7 @@ export function agent_decide(world, agent, senses, actions) {
const tail = result.slice(action.size);
const props = action
- .propose(new_agent, head)
+ .propose(world, new_agent, head)
.reduce(
(acc, proposal) => proposal_merge(acc, proposal),
proposals
diff --git a/src/world/agent.test.js b/src/world/agent.test.js
index 5d5828f..d10a43a 100644
--- a/src/world/agent.test.js
+++ b/src/world/agent.test.js
@@ -13,13 +13,13 @@ test("simple agent decisions", () => {
const senses = [];
const actions = [
- { size: 1, propose: (agent, head) => [{ agent_changes: [{ agent_id: 3, flags: { act1: head[0] } }] }] },
- { size: 1, propose: (agent, head) => [{ agent_changes: [{ agent_id: 3, flags: { act2: head[0] } }] }] },
+ { 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, [idx])).flat(),
+ actions.map((a, idx) => a.propose(null, null, [idx])).flat(),
]);
});