Browse Source

hitgenerator

remotes/origin/Battleship_game
fdai7729 11 months ago
parent
commit
b33ddd54f1
  1. 21
      src/main/c/Template/Battleship_game.c

21
src/main/c/Template/Battleship_game.c

@ -68,6 +68,15 @@ int convertcoor(char a, int b) {
return co; return co;
} }
int hitgenerator() {
int hit;
hit = rand() % 100;
return hit;
}
int singleplayer() { int singleplayer() {
char player[100]; char player[100];
@ -253,7 +262,7 @@ int singleplayer() {
int runde = 1; int runde = 1;
int higherscore = 0; int higherscore = 0;
while (higherscore < 16) {
while (higherscore < 17) {
!feld(player); !feld(player);
printf("Runde %d\n\nScore: %d\n\nPlayer, gib eine Zielkoordinate ein: ", runde, score1); printf("Runde %d\n\nScore: %d\n\nPlayer, gib eine Zielkoordinate ein: ", runde, score1);
@ -285,10 +294,10 @@ int singleplayer() {
system("cls"); system("cls");
if (score1 = 16) {
if (score1 = 17) {
printf("Player 1 hat gewonnen."); printf("Player 1 hat gewonnen.");
} }
if (score2 = 16) {
if (score2 = 17) {
printf("Player 2 hat gewonnen."); printf("Player 2 hat gewonnen.");
} }
@ -628,7 +637,7 @@ int multiplayer() {
int runde = 1; int runde = 1;
int higherscore = 0; int higherscore = 0;
while (higherscore < 16) {
while (higherscore < 17) {
!feld(player1); !feld(player1);
printf("Runde %d\n\nScore: %d\n\nPlayer 1, gib eine Zielkoordinate ein: ", runde, score1); printf("Runde %d\n\nScore: %d\n\nPlayer 1, gib eine Zielkoordinate ein: ", runde, score1);
@ -678,10 +687,10 @@ int multiplayer() {
system("cls"); system("cls");
if (score1 = 16) {
if (score1 = 17) {
printf("Player 1 hat gewonnen."); printf("Player 1 hat gewonnen.");
} }
if (score2 = 16) {
if (score2 = 17) {
printf("Player 2 hat gewonnen."); printf("Player 2 hat gewonnen.");
} }

Loading…
Cancel
Save