diff --git a/src/main/c/Template/Battleship_game.c b/src/main/c/Template/Battleship_game.c index 1a33994..1999e97 100644 --- a/src/main/c/Template/Battleship_game.c +++ b/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; }