From 91ff2ad931b5a47128eac03ba1c94831563a23aa Mon Sep 17 00:00:00 2001 From: Miloslav Macko Date: Wed, 10 Apr 2024 23:17:05 +0200 Subject: [PATCH] ++ --- cv9/snake.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cv9/snake.c b/cv9/snake.c index 27ee822..cad3b4c 100644 --- a/cv9/snake.c +++ b/cv9/snake.c @@ -18,18 +18,14 @@ 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; + struct snake* next_part = snake->next; free(snake); - return new_head; + return next_part; } + int is_snake(struct snake* snake, int x, int y) { while (snake) { if (snake->x == x && snake->y == y) {