Browse Source

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

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

61
src/main/c/Template/Battleship_game.c

@ -532,6 +532,67 @@ int* coorgenerator() {
}
}
shipcoor[12] = co;
shipdirect = rand() % 2;
if (a == 1) {
if (shipdirect == 0) {
for (int i = 13; i < 15; i++) {
co -= 1;
shipcoor[i] = co;
}
}
if (shipdirect == 1) {
for (int i = 13; i < 15; i++) {
co -= 10;
shipcoor[i] = co;
}
}
}
if (a == 2) {
if (shipdirect == 0) {
for (int i = 13; i < 15; i++) {
co -= 1;
shipcoor[i] = co;
}
}
if (shipdirect == 1) {
for (int i = 13; i < 15; i++) {
co += 10;
shipcoor[i] = co;
}
}
}
if (a == 3) {
if (shipdirect == 0) {
for (int i = 13; i < 15; i++) {
co += 1;
shipcoor[i] = co;
}
}
if (shipdirect == 1) {
for (int i = 13; i < 15; i++) {
co -= 10;
shipcoor[i] = co;
}
}
}
if (a == 4) {
if (shipdirect == 0) {
for (int i = 13; i < 15; i++) {
co += 1;
shipcoor[i] = co;
}
}
if (shipdirect == 1) {
for (int i = 13; i < 15; i++) {
co += 10;
shipcoor[i] = co;
}
}
}
return returnarr;
}

Loading…
Cancel
Save