diff options
Diffstat (limited to 'src/simulation/actions.js')
-rw-r--r-- | src/simulation/actions.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/simulation/actions.js b/src/simulation/actions.js index a925867..aaaf1d8 100644 --- a/src/simulation/actions.js +++ b/src/simulation/actions.js @@ -60,9 +60,26 @@ const turn_left = { }; +const turn_right = { + size: 1, + propose: (agent, head) => { + if (head[0] > threshold) { + const orientation = { n: 'e', e: 's', s: 'w', w: 'n' }[agent.flags.orientation]; + return [{ + agent_changes: [{ + agent_id: agent.id, + flags: { orientation }, + }], + }]; + } else { + return []; + } + }, +}; + export const actions = [ - move_forward, move_backward, turn_left, + move_forward, move_backward, turn_left, turn_right, ]; |