A Snake Fork
Posted: Sun Jul 20, 2014 5:15 pm
Last week, i have fork Snake by Ripper121 for do a version that uses a list instead an array, for find a more efficient version of the same game.
But i have a bug: when the snake hits a food, it stops running.
I think that problem is in the function "next_step()" after it's test "hitFood()"
I do not understand what causes the problem.
Can anyone help me?
How can i debug it?
Here the code
But i have a bug: when the snake hits a food, it stops running.
I think that problem is in the function "next_step()" after it's test "hitFood()"
- Code: Select all
void next_step() {
//Controllo se mangia
if (hitFood()) {
insertBody();
score = score + point;
nextFood();
} else {
insertBody();
removeBody();
}
}
I do not understand what causes the problem.
Can anyone help me?
How can i debug it?
Here the code