fix off by 1 error checking for other snake movement

This commit is contained in:
Max Känner 2024-09-02 18:08:28 +02:00
parent 548b7ff7a6
commit 9f7924b24b

View File

@ -44,7 +44,7 @@ impl Battlesnake {
if board
.snakes
.iter()
.filter(|snake| snake.id != self.id && self.length < snake.length)
.filter(|snake| snake.id != self.id && self.length <= snake.length)
.flat_map(|snake| enum_iterator::all().map(|dir| snake.head.move_to(dir)))
.any(|coord| target == coord)
{