1é.4
This commit is contained in:
parent
3d65852834
commit
dd56776a0e
@ -18,12 +18,18 @@ struct snake* remove_snake(struct snake* snake) {
|
||||
// Snake is empty
|
||||
return NULL;
|
||||
}
|
||||
if (!snake->next) {
|
||||
// Snake has only one part
|
||||
free(snake);
|
||||
return NULL;
|
||||
}
|
||||
struct snake* new_head = snake->next;
|
||||
free(snake);
|
||||
return new_head;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int is_snake(struct snake* snake, int x, int y) {
|
||||
while (snake) {
|
||||
if (snake->x == x && snake->y == y) {
|
||||
|
Loading…
Reference in New Issue
Block a user