summaryrefslogtreecommitdiff
path: root/src/simulation/actions.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-11-11 14:14:30 -0600
committersanine <sanine.not@pm.me>2023-11-11 14:14:30 -0600
commit8323707d3a2945f8fbd4d4e925a04d1eb6f0a3b7 (patch)
treea78c0957342566e93f9e8045fe0d22fd45818e71 /src/simulation/actions.js
parent78f2f5f4b1ccd58bbdef0d5e5d2dd026ac4ad668 (diff)
prevent movement when frozen and allow seeing past the lattice edge
Diffstat (limited to 'src/simulation/actions.js')
-rw-r--r--src/simulation/actions.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/simulation/actions.js b/src/simulation/actions.js
index 78345ce..4ee17d8 100644
--- a/src/simulation/actions.js
+++ b/src/simulation/actions.js
@@ -6,6 +6,7 @@ const threshold = 0.5;
const move_forward = {
size: 1,
propose: (world, agent, head) => {
+ if (agent.flags.frozen === true) { return []; }
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];
@@ -26,6 +27,7 @@ const move_forward = {
const move_backward = {
size: 1,
propose: (world, agent, head) => {
+ if (agent.flags.frozen === true) { return []; }
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];
@@ -46,6 +48,7 @@ const move_backward = {
const turn_left = {
size: 1,
propose: (world, agent, head) => {
+ if (agent.flags.frozen === true) { return []; }
if (head[0] > threshold) {
const orientation = { n: 'w', e: 'n', s: 'e', w: 's' }[agent.flags.orientation];
return [{
@@ -64,6 +67,7 @@ const turn_left = {
const turn_right = {
size: 1,
propose: (world, agent, head) => {
+ if (agent.flags.frozen === true) { return []; }
if (head[0] > threshold) {
const orientation = { n: 'e', e: 's', s: 'w', w: 'n' }[agent.flags.orientation];
return [{