Merge branch 'master' of git.kemt.fei.tuke.sk:bk403nv/pvjc24
This commit is contained in:
commit
0b1c56bd70
10
cv9/snake.c
10
cv9/snake.c
@ -9,7 +9,7 @@ struct snake* add_snake(struct snake* snake,int x,int y){
|
|||||||
head->x = x;
|
head->x = x;
|
||||||
head->y = y;
|
head->y = y;
|
||||||
head->next = snake;
|
head->next = snake;
|
||||||
return snake;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct snake* remove_snake(struct snake* snake){
|
struct snake* remove_snake(struct snake* snake){
|
||||||
@ -40,10 +40,12 @@ void free_snake(struct snake* sn){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int is_snake(struct snake* snake,int x,int y){
|
int is_snake(struct snake* snake,int x,int y){
|
||||||
if(snake == NULL)
|
struct snake* this = snake;
|
||||||
return NULL;
|
while(this != NULL){
|
||||||
if(x == snake->x && y == snake->y)
|
if(this->x == x && this->y == y)
|
||||||
return 1;
|
return 1;
|
||||||
|
this = this->next;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user