summaryrefslogtreecommitdiff
path: root/src/simulation/senses.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulation/senses.js')
-rw-r--r--src/simulation/senses.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/simulation/senses.js b/src/simulation/senses.js
index d3e7c1e..9cc6c41 100644
--- a/src/simulation/senses.js
+++ b/src/simulation/senses.js
@@ -99,8 +99,9 @@ function vision_idx_to_world_pos(world, agent, idx) {
function see_cell(world, x, y) {
const team = 0;
const orientation = 0;
- if (!world.lattice[y][x]) {
- throw new Error(`${x}, ${y}`);
+ if (!world.lattice[y] || !world.lattice[y][x]) {
+ // beyond the map edge
+ return [ 0, 0, 0 ];
}
const type = {
active: -0.8,