'use strict'; const threshold = 0.5; const move_forward = { size: 1, propose: (agent, head) => { if (head[0] > threshold) { 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 [{ agent_changes: [{ agent_id: agent.id, x: agent.x + dx, y: agent.y + dy, }], }]; } else { return []; } }, }; export const actions = [ move_forward, ];