From b87ac2585490b78d95f2d7f86955fc3975c78689 Mon Sep 17 00:00:00 2001 From: fdai7729 <nina.gaertner1@informatik.hs-fulda.de> Date: Wed, 7 Feb 2024 02:19:36 +0000 Subject: [PATCH] Update src/main/c/Template/Battleship_game.c --- src/main/c/Template/Battleship_game.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/c/Template/Battleship_game.c b/src/main/c/Template/Battleship_game.c index a408c89..1ce9e01 100644 --- a/src/main/c/Template/Battleship_game.c +++ b/src/main/c/Template/Battleship_game.c @@ -226,7 +226,26 @@ int singleplayer() { !feld(ships1); + while (score1 || score2 < 16) { + + !feld(player); + printf("Player 1, gib eine Zielkoordinate ein: "); + scanf(" %c%d", &letco, &numco); + coor = convertcoor(letco, numco); + + if (ships2[coor] == 'X') { + player[coor] = 'X'; + score1 += 1; + printf("Treffer!!\n"); + } + else { + player[coor] = '-'; + printf("Kein Treffer.\n"); + } + } + + return 0; } int multiplayer() {