Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Sometimes snakes might die with a valid move (CollisionWithSnake) #112

Open
Dolvur opened this issue Apr 15, 2023 · 0 comments
Open
Assignees
Labels

Comments

@Dolvur
Copy link
Contributor

Dolvur commented Apr 15, 2023

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:

snakey dies valid moves logs

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.

@Dolvur Dolvur added the bug label Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants