From effc2739bf3ce18d90c4f04e53ef58a871f3c246 Mon Sep 17 00:00:00 2001 From: fdai8040 Date: Sat, 3 Feb 2024 17:05:06 +0000 Subject: [PATCH] Implementierung checkGameEnd --- src/main/c/Pong/pong.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/c/Pong/pong.c b/src/main/c/Pong/pong.c index 5d9eb00..a395207 100644 --- a/src/main/c/Pong/pong.c +++ b/src/main/c/Pong/pong.c @@ -203,6 +203,14 @@ 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; }