Browse Source

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

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

24
src/main/c/Template/Battleship_game.c

@ -83,6 +83,30 @@ int* coorgenerator() {
exit(1);
}
srand(time(NULL));
//(5)-er
int ranco = rand() % 4;
co = randomcoor[ranco];
int ranvers = rand()%5;
int randirect = rand()%4;
if (randirect == 0) {
co = co + ranvers;
}
if (randirect == 1) {
co = co - ranvers;
}
if (randirect == 2) {
co = co + 10*ranvers;
}
if (randirect == 3) {
co = co - 10*ranvers;
}
return returnarr;
}

Loading…
Cancel
Save