From c7b2ed70600d20cf995d17dfadc9108b5b17720d Mon Sep 17 00:00:00 2001 From: vafan Date: Thu, 16 Apr 2026 20:44:38 +0000 Subject: [PATCH] newssos --- du4/snake.c | 55 ----------------------------------------------------- 1 file changed, 55 deletions(-) diff --git a/du4/snake.c b/du4/snake.c index 4de2997..f190213 100644 --- a/du4/snake.c +++ b/du4/snake.c @@ -125,58 +125,3 @@ int step_state(struct state* state) { return END_CONTINUE; } - -void display_game(struct state* game) { - printf("SNAKE GAME\n"); - - for (int y = 0; y < 10; y++) { - for (int x = 0; x < 20; x++) { - int head = (game->snake->x == x && game->snake->y == y); - int body = is_snake(game->snake->next, x, y); - int food = 0; - - for (int i = 0; i < FOOD_COUNT; i++) { - if (game->foodx[i] == x && game->foody[i] == y) { - food = 1; - break; - } - } - - if (head) printf("S"); - else if (body) printf("+"); - else if (food) printf("F"); - else printf(" "); - } - printf("\n"); - } -} - -void start_game(struct state* game) { - game->snake = add_snake(NULL, 10, 5); - game->snake = add_snake(game->snake, 9, 5); - - game->sx = 1; - game->sy = 0; - game->width = 20; - game->height = 10; - - for (int i = 0; i < FOOD_COUNT; i++) { - game->foodx[i] = 5 + i * 2; - game->foody[i] = 3 + i; - } -} - -int main(void) { - struct state game; - start_game(&game); - - display_game(&game); - - int status = step_state(&game); - - printf("Game status: %d\n", status); - - free_snake(game.snake); - - return 0; -}