From 5bf3c34f511538039b953075f74b5ccdecaafa22 Mon Sep 17 00:00:00 2001 From: Carlos Date: Fri, 19 Feb 2021 02:34:26 -0300 Subject: [PATCH] Update : common if --- games/naval_battle.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/games/naval_battle.c b/games/naval_battle.c index 7e0db28e..9454a19b 100644 --- a/games/naval_battle.c +++ b/games/naval_battle.c @@ -29,7 +29,7 @@ int validEntryLineColumn(int line, char column) return 1; } - return 0 ; + return 0; } /** * @brief Function validatePosition @@ -46,17 +46,8 @@ int validatePosition(int mat[10][10], int boat, int line, int column, int cont = 0; int i, j; - if (boat < 1 || boat > 3) - { - return 0; - } - - if (guide != 'H' && guide != 'V') - { - return 0; - } - - if ((line < 0 || line > 9) || (column < 0 || column > 9)) + if (line < 0 || line > 9 || column < 0 || column > 9 || + (guide != 'H' && guide != 'V') || boat < 1 || boat > 3) { return 0; } @@ -102,10 +93,7 @@ int validatePosition(int mat[10][10], int boat, int line, int column, { return 1; } - else - { - return 0; - } + return 0; } /** * @brief Function canShoot