From 99551aba4d2a20ce28f83950b8f7cc93b6401bc9 Mon Sep 17 00:00:00 2001 From: fdai7729 Date: Fri, 9 Feb 2024 03:48:02 +0000 Subject: [PATCH] Update src/main/c/Template/Battleship_game.c --- src/main/c/Template/Battleship_game.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/c/Template/Battleship_game.c b/src/main/c/Template/Battleship_game.c index 17bc5e6..7248d42 100644 --- a/src/main/c/Template/Battleship_game.c +++ b/src/main/c/Template/Battleship_game.c @@ -339,6 +339,29 @@ int* coorgenerator() { } } + //(3)-er 1 + + 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; }