Browse Source

Update src/main/c/Template/Battleship_game.c

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

39
src/main/c/Template/Battleship_game.c

@ -82,7 +82,7 @@ int multiplayer() {
char ships2[100]; char ships2[100];
char letco; char letco;
int numco, coor;
int numco, coor, coor1, coor2;
int score1 = 0; int score1 = 0;
int score2 = 0; int score2 = 0;
@ -113,22 +113,37 @@ int multiplayer() {
!feld(multi); !feld(multi);
int k1 = 1;
do
{
printf("Player 1, platziere deine Schiffe.\nKoordinate: ");
printf("Player 1, platziere dein Schlachtschiff (5).\nKoordinate: ");
scanf(" %c%d", &letco, &numco); scanf(" %c%d", &letco, &numco);
coor = convertcoor(letco, numco);
ships1[coor] = 'X';
!feld(ships1);
coor1 = convertcoor(letco, numco);
ships1[coor1] = 'X';
for (int i = 0; i < 4; i++) {
!feld(ships1);
printf("\n");
scanf(" %c%d", &letco, &numco);
coor2 = convertcoor(letco, numco);
if (coor2 == coor1 + 1 || coor2 == coor1 - 1) {
ships1[coor2] = 'X';
coor1 = coor2;
}
else if (coor2 == coor1 + 10 || coor2 == coor1 - 10) {
ships1[coor2] = 'X';
coor1 = coor2;
}
else {
printf("Ungueltige Eingabe.\n");
i--;
}
!feld(ships1);
}
k1++;
} while (k1 < 17);
int k2 = 1; int k2 = 1;

Loading…
Cancel
Save