is snake
This commit is contained in:
parent
69eaba6642
commit
bab6423fb9
14
cv9/snake.c
14
cv9/snake.c
@ -35,8 +35,22 @@ void free_snake(struct snake* sn){
|
||||
}
|
||||
|
||||
int is_snake(struct snake* snake,int x,int y){
|
||||
if(snake == NULL){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct snake* pozicia = snake;
|
||||
|
||||
while(pozicia != NULL){
|
||||
if(pozicia->x == x && pozicia->y == y){
|
||||
return 1;
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int step_state(struct state* st){
|
||||
int nx = (st->snake->x + st->sx);
|
||||
|
Loading…
Reference in New Issue
Block a user