Browse Source

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

remotes/origin/Battleship_game
fdai7729 11 months ago
parent
commit
5c20512317
  1. 50
      src/main/c/Template/Battleship_game.c

50
src/main/c/Template/Battleship_game.c

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

Loading…
Cancel
Save