From 7825b92ce3be95a0ce1dfea9388adbaadce83b1f Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 12 Nov 2023 15:18:29 -0600 Subject: fix bugs --- src/simulation/actions.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/simulation/actions.js') diff --git a/src/simulation/actions.js b/src/simulation/actions.js index 3b3e942..ad08572 100644 --- a/src/simulation/actions.js +++ b/src/simulation/actions.js @@ -9,6 +9,7 @@ const move_forward = { if (agent.flags.frozen === true) { return []; } if (head[0] > threshold) { console.log('move forward'); + console.log(agent.id, agent.x, agent.y); const dx = { n: 0, e: 1, s: 0, w: -1 }[agent.flags.orientation]; const dy = { n: -1, e: 0, s: 1, w: 0 }[agent.flags.orientation]; return [{ @@ -30,6 +31,7 @@ const move_backward = { propose: (world, agent, head) => { if (agent.flags.frozen === true) { return []; } if (head[0] > threshold) { + console.log('move backward'); const dx = { n: 0, e: 1, s: 0, w: -1 }[agent.flags.orientation]; const dy = { n: -1, e: 0, s: 1, w: 0 }[agent.flags.orientation]; return [{ @@ -51,6 +53,7 @@ const turn_left = { propose: (world, agent, head) => { if (agent.flags.frozen === true) { return []; } if (head[0] > threshold) { + console.log('turn left'); const orientation = { n: 'w', e: 'n', s: 'e', w: 's' }[agent.flags.orientation]; return [{ agent_changes: [{ @@ -70,6 +73,7 @@ const turn_right = { propose: (world, agent, head) => { if (agent.flags.frozen === true) { return []; } if (head[0] > threshold) { + console.log('turn right'); const orientation = { n: 'e', e: 's', s: 'w', w: 'n' }[agent.flags.orientation]; return [{ agent_changes: [{ @@ -250,7 +254,7 @@ const speak = { export const actions = [ - move_forward, move_backward, turn_left, turn_right, + move_forward, /*move_backward, */turn_left, turn_right, place, trigger, pretend_frozen, unfreeze, take_flag, drop_flag, speak, ]; -- cgit v1.2.1