|
@ -76,7 +76,6 @@ int singleplayer() { |
|
|
|
|
|
|
|
|
int multiplayer() { |
|
|
int multiplayer() { |
|
|
|
|
|
|
|
|
char multi[100]; |
|
|
|
|
|
char player1[100]; |
|
|
char player1[100]; |
|
|
char player2[100]; |
|
|
char player2[100]; |
|
|
char ships1[100]; |
|
|
char ships1[100]; |
|
@ -84,13 +83,9 @@ int multiplayer() { |
|
|
|
|
|
|
|
|
char letco; |
|
|
char letco; |
|
|
int numco, coor; |
|
|
int numco, coor; |
|
|
int score1, score2; |
|
|
|
|
|
|
|
|
int score1 = 0; |
|
|
|
|
|
int score2 = 0; |
|
|
|
|
|
|
|
|
for (int i = 0; i <= 99; i++) { |
|
|
|
|
|
|
|
|
|
|
|
multi[i] = '0'; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i <= 99; i++) { |
|
|
for (int i = 0; i <= 99; i++) { |
|
|
|
|
|
|
|
@ -156,17 +151,15 @@ int multiplayer() { |
|
|
printf("\n\n\n"); |
|
|
printf("\n\n\n"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!feld(player1); |
|
|
|
|
|
|
|
|
|
|
|
while (score1<16 !! score2 < 16) { |
|
|
|
|
|
|
|
|
while (score1 || score2 < 16) { |
|
|
|
|
|
|
|
|
!feld(player1); |
|
|
!feld(player1); |
|
|
printf("Gib eine Zielkoordinate ein: "); |
|
|
|
|
|
|
|
|
printf("Player 1, gib eine Zielkoordinate ein: "); |
|
|
scanf(" %c%d", &letco, &numco); |
|
|
scanf(" %c%d", &letco, &numco); |
|
|
|
|
|
|
|
|
coor = convertcoor(letco, numco); |
|
|
coor = convertcoor(letco, numco); |
|
|
|
|
|
|
|
|
if (player1[coor] == ships2[coor]) { |
|
|
|
|
|
|
|
|
if (ships2[coor] = 'X') { |
|
|
player1[coor] = 'X'; |
|
|
player1[coor] = 'X'; |
|
|
score1 += 1; |
|
|
score1 += 1; |
|
|
printf("Treffer!!\n"); |
|
|
printf("Treffer!!\n"); |
|
@ -175,7 +168,22 @@ int multiplayer() { |
|
|
player[coor] = '-' |
|
|
player[coor] = '-' |
|
|
printf("Kein Treffer.\n") |
|
|
printf("Kein Treffer.\n") |
|
|
} |
|
|
} |
|
|
!feld(player1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!feld(player2); |
|
|
|
|
|
printf("Player 2, gib eine Zielkoordinate ein: "); |
|
|
|
|
|
scanf(" %c%d", &letco, &numco); |
|
|
|
|
|
|
|
|
|
|
|
coor = convertcoor(letco, numco); |
|
|
|
|
|
|
|
|
|
|
|
if (ships1[coor] == 'X') { |
|
|
|
|
|
player2[coor] = 'X'; |
|
|
|
|
|
score2 += 1; |
|
|
|
|
|
printf("Treffer!!\n"); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
player2[coor] = '-'; |
|
|
|
|
|
printf("Kein Treffer.\n"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|