From 5b0a096502b6c7bf33a6793b43e73e94ae17305b Mon Sep 17 00:00:00 2001 From: spatialfree Date: Sun, 10 Nov 2024 05:08:05 -0500 Subject: [PATCH] don't move if next pos is not in or around box --- src/Mono.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Mono.cs b/src/Mono.cs index 37ad4cf..9d31865 100644 --- a/src/Mono.cs +++ b/src/Mono.cs @@ -127,14 +127,8 @@ static class Mono return; } - XYZi next_pos = snake[0] + snake_dir; - XYZi inset_pos = new( - next_pos.x - Maths.sign(next_pos.x), - next_pos.y - Maths.sign(next_pos.y), - next_pos.z - Maths.sign(next_pos.z) - ); - bool around_box = s_array.InRange(inset_pos); - if (!around_box) + bool in_or_around_box = s_array.InRange(snake[0] + snake_dir); + if (!in_or_around_box) { return; }