diff --git a/src/Mono.cs b/src/Mono.cs index fca97db..a60c14b 100644 --- a/src/Mono.cs +++ b/src/Mono.cs @@ -89,6 +89,32 @@ static class Mono return; } + XYZi next_pos = snake[0] + snake_dir; + bool around_box = false; + for (int i = 0; i < directions.Length; i++) + { + if (s_array.InRange(next_pos + directions[i])) + { + around_box = true; + break; + } + } + if (!around_box) + { + for (int i = 0; i < corners.Length; i++) + { + if (s_array.InRange(next_pos + corners[i])) + { + around_box = true; + break; + } + } + } + if (!around_box) + { + return; + } + if (snake_len == snake.Length) { // win condition