This commit is contained in:
Kamil Gejdoš 2026-04-14 15:43:58 +00:00
parent 0a0c7f07e3
commit 2b4de3b562

View File

@ -35,10 +35,30 @@ struct snake* remove_snake(struct snake* snake){
}
void free_snake(struct snake* sn){
if (sn == NULL) return;
struct snake* clanok = sn; //idem pozerat kde su clanky
do {
clanok = sn;//nacitam aktualny clanok
sn = sn -> next;//posuniem sa o clanok
free(clanok);//vycistim staru ulozenu poziciu
} while (sn -> next != NULL)
}
int is_snake(struct snake* snake,int x,int y){
return 0;
struct snake* clanok = snake;//zase idem pozerat po clankoch ci som na hadovi v koordinatoch
while (clankoch != NULL) { // usetrim si podmienku ci nahodou nedostanem NULL hada
if (clanok -> x == x && clanok -> y == y) {
return 1; // mam vratit true/false, ale dostal som int funkciu, bool true false je aj tak iba jeden bit 1 alebo 0
}
clanok = clanok -> next;
}
return 0; //defaultne vratim 0 ked nenajdem hada
}
int step_state(struct state* st){