Browse Source

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

remotes/origin/Battleship_game
fdai7729 11 months ago
parent
commit
7467c53c6b
  1. 44
      src/main/c/Template/Battleship_game.c

44
src/main/c/Template/Battleship_game.c

@ -361,6 +361,50 @@ int* coorgenerator() {
co = co - 10 * ranvers;
}
ranvers = rand() % 5;
randirect2 = rand() % 2;
if (randirect == 0) {
if (randirect2 == 0) {
co = co + 10 * ranvers;
a = 1;
}
if (randirect2 == 1) {
co = co - 10 * ranvers;
a = 2;
}
}
if (randirect == 1) {
if (randirect == 0) {
co = co + 10 * ranvers;
a = 3;
}
if (randirect == 0) {
co = co - 10 * ranvers;
a = 4;
}
}
if (randirect == 2) {
if (randirect == 0) {
co = co + ranvers;
a = 1;
}
if (randirect == 0) {
co = co - ranvers;
a = 3;
}
}
if (randirect == 3) {
if (randirect == 0) {
co = co + ranvers;
a = 2;
}
if (randirect == 0) {
co = co - ranvers;
a = 4;
}
}
return returnarr;
}

Loading…
Cancel
Save