From fdddc3ffc617ddc1dbcc39bca9d691bb5ea9a9a3 Mon Sep 17 00:00:00 2001 From: fdai8040 Date: Sat, 3 Feb 2024 17:25:47 +0000 Subject: [PATCH] refactoring: checkGameEnd_verschoben --- src/main/c/Pong/pong.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/c/Pong/pong.c b/src/main/c/Pong/pong.c index a395207..09b72f0 100644 --- a/src/main/c/Pong/pong.c +++ b/src/main/c/Pong/pong.c @@ -124,6 +124,14 @@ void resetScore(int *score1, int *score2) { *score2 = 0; } +int checkGameEnd(int score1, int score2, int maxScore) { + if (score1 >= maxScore || score2 >= maxScore) { + return 1; // Das Spiel endet + } else { + return 0; // Das Spiel endet nicht + } +} + int pong(){ int paddle1PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; int paddle2PositionY = HEIGHT / 2 - PADDLE_LENGTH / 2; @@ -203,14 +211,6 @@ int pong(){ printf("Spieler 2 gewinnt!\n"); } -int checkGameEnd(int score1, int score2, int maxScore) { - if (score1 >= maxScore || score2 >= maxScore) { - return 1; // Das Spiel endet - } else { - return 0; // Das Spiel endet nicht - } -} - return 0; }