From 70f9ed5e68025bd42fc5d65859c2e1b105416c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Vl=C4=8Dek?= Date: Wed, 15 Apr 2026 22:57:01 +0000 Subject: [PATCH] Aktualizovat du4 /snake.c --- du4 /snake.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/du4 /snake.c b/du4 /snake.c index 9743fd5..881f20b 100644 --- a/du4 /snake.c +++ b/du4 /snake.c @@ -79,7 +79,7 @@ int is_snake(struct snake* snake,int x,int y){ FAZY: 1. -> Kontrola kolizie (seba + vs. stien) 2. -> Kontrola logiky zobratia jedla (resp. kolizie s jedlom, update statusu, pripadny narast hada) 3. -> Realizacia pohybu - 4. -> finalna kontrola poctu jedla*/ + 4. -> finalna kontrola poctu jedla */ int step_state(struct state* st){ int nx = (st->snake->x + st->sx); int ny = (st->snake->y + st->sy); @@ -112,9 +112,11 @@ int step_state(struct state* st){ st->foodx[i] = -1; st->foody[i] = -1; - add_snake(st->snake; nx, ny); + add_snake(st->snake, nx, ny); hasEatenFoodinThisCycle = true; + + break; } //hra bude pokracovat normalne dalej, ak NIE JE vsetko jedlo zobrate if (st->foodx[i] != -1) @@ -123,7 +125,7 @@ int step_state(struct state* st){ } } - //normalny pohyb snake-a (ak jedlo nebolo zjedene) + //normalny pohyb snake-a (ak jedlo nebolo zjedene v tomto update cykle) if (!hasEatenFoodinThisCycle) { st->snake = add_snake(st->snake, nx, ny);