#include "world.h" #include "snake.h" #include #include #include int main(){ struct state game_world; // Initialize the game world with dimensions 20x20 init_world(&game_world, 20, 20); // Run the game loop until the game ends while(1){ print_world(&game_world); // Update the game state based on snake movement int game_status = step_state(&game_world); // Check the result of the move if (game_status == END_WALL) { printf("Game Over: Hit the Wall!\n"); break; } if (game_status == END_SNAKE) { printf("Game Over: Snake hit itself!\n"); break; } if (game_status == END_FOOD) { printf("Congratulations! You ate all the food!\n"); break; } sleep(1); } free_snake(game_world.snake); return 0; }