Browse Source

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

remotes/origin/Battleship_game
fdai7729 11 months ago
parent
commit
3badada5da
  1. 18
      src/main/c/Template/Battleship_game.c

18
src/main/c/Template/Battleship_game.c

@ -68,6 +68,24 @@ int convertcoor(char a, int b) {
return co;
}
int* coorgenerator() {
int randomcoor[100] = {44, 45, 55, 54, 53, 43, 33, 34, 35, 36, 46, 56, 66, 65, 64, 63, 62, 52, 42, 32, 22, 23, 24, 25, 26, 27, 37, 47, 57, 67, 77, 76, 75, 74, 73, 72, 71, 61, 51, 41, 31, 21, 11, 12, 13, 14, 15, 16, 17, 18, 28, 38, 48, 58, 68, 78, 88, 87, 86, 85, 84, 83, 82, 81, 80, 70, 60, 50, 40, 30, 20, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90};
int shipcoor[17];
int* shipcoorptr[17];
int co, vers, direct;
int a = 0;
int* returnarr = (int*)malloc(17* sizeof(int));
if (returnarr == NULL) {
perror("Memory allocation failed");
exit(1);
}
return returnarr;
}
int hitgenerator() {
int hit;

Loading…
Cancel
Save