From 541a9c15441d158f39d96e49a798905703c9db9e Mon Sep 17 00:00:00 2001 From: Denys Sanchuk Date: Tue, 8 Apr 2025 12:41:39 +0000 Subject: [PATCH] Aktualizovat du5/snake.c --- du5/snake.c | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/du5/snake.c b/du5/snake.c index b52aa90..73b3868 100644 --- a/du5/snake.c +++ b/du5/snake.c @@ -40,39 +40,4 @@ void free_snake(struct snake* sn) { free(sn); sn = next; } -} -int step_state(struct state* state) { - int new_x = state->snake->x + state->sx; - int new_y = state->snake->y + state->sy; - - if (new_x < 0 || new_x >= state->width || new_y < 0 || new_y >= state->height) { - return END_WALL; - } - - if (is_snake(state->snake, new_x, new_y)) { - return END_SNAKE; - } - - for (int i = 0; i < FOOD_COUNT; i++) { - if (state->foodx[i] == new_x && state->foody[i] == new_y) { - state->snake = add_snake(state->snake, new_x, new_y); - state->foodx[i] = -1; - state->foody[i] = -1; - - int food_left = 0; - for (int j = 0; j < FOOD_COUNT; j++) { - if (state->foodx[j] >= 0 && state->foody[j] >= 0) { - food_left = 1; - break; - } - } - - return food_left ? END_CONTINUE : END_FOOD; - } - } - - state->snake = add_snake(state->snake, new_x, new_y); - state->snake = remove_snake(state->snake); - return END_CONTINUE; -} - +} \ No newline at end of file