From b33ddd54f145f3ed0a09d73b7d481b1e3cfbeea4 Mon Sep 17 00:00:00 2001 From: fdai7729 Date: Fri, 9 Feb 2024 03:26:00 +0000 Subject: [PATCH] hitgenerator --- src/main/c/Template/Battleship_game.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/c/Template/Battleship_game.c b/src/main/c/Template/Battleship_game.c index 752790a..d71e93a 100644 --- a/src/main/c/Template/Battleship_game.c +++ b/src/main/c/Template/Battleship_game.c @@ -68,6 +68,15 @@ int convertcoor(char a, int b) { return co; } +int hitgenerator() { + + int hit; + + hit = rand() % 100; + + return hit; +} + int singleplayer() { char player[100]; @@ -253,7 +262,7 @@ int singleplayer() { int runde = 1; int higherscore = 0; - while (higherscore < 16) { + while (higherscore < 17) { !feld(player); printf("Runde %d\n\nScore: %d\n\nPlayer, gib eine Zielkoordinate ein: ", runde, score1); @@ -285,10 +294,10 @@ int singleplayer() { system("cls"); - if (score1 = 16) { + if (score1 = 17) { printf("Player 1 hat gewonnen."); } - if (score2 = 16) { + if (score2 = 17) { printf("Player 2 hat gewonnen."); } @@ -628,7 +637,7 @@ int multiplayer() { int runde = 1; int higherscore = 0; - while (higherscore < 16) { + while (higherscore < 17) { !feld(player1); printf("Runde %d\n\nScore: %d\n\nPlayer 1, gib eine Zielkoordinate ein: ", runde, score1); @@ -678,10 +687,10 @@ int multiplayer() { system("cls"); - if (score1 = 16) { + if (score1 = 17) { printf("Player 1 hat gewonnen."); } - if (score2 = 16) { + if (score2 = 17) { printf("Player 2 hat gewonnen."); }