From 886dcc00796f60b53e43f728d27b9f2f8dee2ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Vasi=C4=BE?= Date: Wed, 27 Apr 2022 19:01:10 +0200 Subject: [PATCH] domaca_uloha_7 --- du7/snake.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/du7/snake.c b/du7/snake.c index bd4d117..b98ffbf 100644 --- a/du7/snake.c +++ b/du7/snake.c @@ -52,9 +52,8 @@ int is_snake(struct snake* snake,int x,int y){ if (snake == NULL) return 0; do { - if (snake->x == x) { - if (snake->y == y) return 1; - } + if (snake->x == x || snake->y == y) return 1; + snake = snake->next; } while (snake->next != NULL);