From 6b47c084f8aa5e51f96d82f117daa11618a1df3d Mon Sep 17 00:00:00 2001 From: fdai7729 Date: Fri, 9 Feb 2024 03:49:28 +0000 Subject: [PATCH] Update src/main/c/Template/Battleship_game.c --- src/main/c/Template/Battleship_game.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/c/Template/Battleship_game.c b/src/main/c/Template/Battleship_game.c index f98b728..b449e29 100644 --- a/src/main/c/Template/Battleship_game.c +++ b/src/main/c/Template/Battleship_game.c @@ -466,6 +466,28 @@ int* coorgenerator() { } } + //(3)-er 2 + + ranco = rand() % 4; + + co = randomcoor[ranco]; + + ranvers = rand() % 5; + 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; }