-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
I have noticed that snakes sometimes die with a valid move. Below is an example of this with the training bot Snakey dying.
Snakey.dying.valid.move.mp4
I have gotten similar behavior with my own bot sometimes when running and was confused since the direction it printed to go was a valid direction. This time I noticed it happening with one of the training bots and I even logged all the directions received from the server:
The exception raised is CollisionWithSnake and not CollisionWithSelf. This only seems to be called at MoveSnake.java
// Snakes are allowed to follow their own tail as long as
// they don't grow or their tail comes after their head.
// Collision with an opponent's tail cannot happen here because
// this transformer expects only one snake in the world.
if (targetContent instanceof SnakePart ) &&
(forceGrowth ||
!((SnakePart)targetContent).isTail() ||
snakeHead.getLength() == 2)) {
throw new SnakeCollision(targetSnakePos, snakeHead);
}
Unsure if this is the issue but this part looks correlated with the other bug #111
@emilb perhaps you have an idea?
I am gonna test a little bit more, but the bug is very inconsistent.