From bcf6465f4e16e8b60ccc790c1d86c6a38073f040 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Wed, 1 Nov 2023 13:27:42 +0300 Subject: [PATCH] Optimize game over condition --- src/main.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index 944aaa8..380054c 100644 --- a/src/main.c +++ b/src/main.c @@ -70,14 +70,9 @@ int main(int argc, char **argv) if (playerDoTick(player, food)) food = generateFood(player); - if (playerCheckSelfCollision(player)) - { - *running = false; - break; - } head_x = player->head->x; head_y = player->head->y; - if (head_x >= SIZE || head_x < 0 || head_y >= SIZE || head_y < 0) + if (head_x >= SIZE || head_x < 0 || head_y >= SIZE || head_y < 0 || playerCheckSelfCollision(player)) { *running = false; break;