Оновити 'cv9/snake.c'

This commit is contained in:
Kapliuk 2024-04-18 17:21:16 +00:00
parent 129a0ae833
commit b1389d8c29

View File

@ -40,10 +40,12 @@ void free_snake(struct snake* sn){
}
int is_snake(struct snake* snake,int x,int y){
if(snake == NULL)
return NULL;
if(snake->x == x && snake->y == y)
struct snake* this = snake;
while(this != NULL){
if(this->x == x && this->y == y)
return 1;
this = this->next;
}
return 0;
}