From a6629af6805612d3ed140fc84f170b97cd7fd292 Mon Sep 17 00:00:00 2001 From: fdai7729 Date: Mon, 5 Feb 2024 22:16:07 +0000 Subject: [PATCH] Update src/main/c/Template/Battleship_game.c --- src/main/c/Template/Battleship_game.c | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/main/c/Template/Battleship_game.c b/src/main/c/Template/Battleship_game.c index 83bea8b..315a2aa 100644 --- a/src/main/c/Template/Battleship_game.c +++ b/src/main/c/Template/Battleship_game.c @@ -31,6 +31,40 @@ int feld(char prifield[]) { return 0; } +int convertcoor(char a, int b) { + + int co = 0; + + switch (a) { + case 'A': co = 0; break; + case 'a': co = 0; break; + case 'B': co = 10; break; + case 'b': co = 10; break; + case 'C': co = 20; break; + case 'c': co = 20; break; + case 'D': co = 30; break; + case 'd': co = 30; break; + case 'E': co = 40; break; + case 'e': co = 40; break; + case 'F': co = 50; break; + case 'f': co = 50; break; + case 'G': co = 60; break; + case 'g': co = 60; break; + case 'H': co = 70; break; + case 'h': co = 70; break; + case 'I': co = 80; break; + case 'i': co = 80; break; + case 'J': co = 90; break; + case 'j': co = 90; break; + default: co = 0; + } + + co += b; + co -= 1; + + return co; +} + int singleplayer() {