fix off by 1 error checking for other snake movement
This commit is contained in:
parent
548b7ff7a6
commit
9f7924b24b
@ -44,7 +44,7 @@ impl Battlesnake {
|
|||||||
if board
|
if board
|
||||||
.snakes
|
.snakes
|
||||||
.iter()
|
.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)))
|
.flat_map(|snake| enum_iterator::all().map(|dir| snake.head.move_to(dir)))
|
||||||
.any(|coord| target == coord)
|
.any(|coord| target == coord)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user