Update : Description of functions

This commit is contained in:
Carlos 2021-02-18 02:33:38 -03:00
parent e4f0541744
commit ef10b322a2

View File

@ -12,11 +12,11 @@
#include <stdio.h> // for Standard Input Output #include <stdio.h> // for Standard Input Output
/** /**
* Function validEntryLineColumn * @brief Function validEntryLineColumn
* Responsible for validating entries, for positioning boats * Responsible for validating entries, for positioning boats
* @param line -> matrix row * @param line matrix row
* @param column -> matrix column * @param column matrix column
* @returns -> validates row and column entry of the board * @returns if the row and column are valid
*/ */
int validEntryLineColumn(int line, char column) int validEntryLineColumn(int line, char column)
{ {
@ -29,13 +29,13 @@ int validEntryLineColumn(int line, char column)
return 0; return 0;
} }
/** /**
* Function validatePosition * @brief Function validatePosition
* Responsible for checking if the position can receive the boat. * Responsible for checking if the position can receive the boat.
* @param -> mat board * @param mat board
* @param -> boat boat * @param boat boat
* @param -> line matrix row * @param line matrix row
* @param -> column matrix column * @param column matrix column
* @returns -> checks if the position is valid * @returns if the position is valid
*/ */
int validatePosition(int mat[10][10], int boat, int line, int column, int validatePosition(int mat[10][10], int boat, int line, int column,
char guide) char guide)
@ -90,12 +90,12 @@ int validatePosition(int mat[10][10], int boat, int line, int column,
} }
} }
/** /**
* Function canShoot * @brief Function canShoot
* Responsible to verify that it is a valid position to shoot * Responsible to verify that it is a valid position to shoot
* @param mat -> board * @param mat board
* @param line -> matrix row * @param line matrix row
* @param column -> matrix column * @param column matrix column
* @returns -> checks if the position is valid for shooting * @returns if the position is valid for shooting
*/ */
int canShoot(int mat[10][10], int line, int column) int canShoot(int mat[10][10], int line, int column)
@ -113,11 +113,10 @@ int canShoot(int mat[10][10], int line, int column)
} }
} }
/** /**
* Function positionBoat * @brief Function positionBoat
* Responsible for placing the boats on the board, according to the size. * Responsible for placing the boats on the board, according to the size.
* @param mat -> board * @param mat board
* @param boat -> boat * @param boat boat
* @returns(void) -> position the boat on the board
*/ */
void positionBoat(int mat[10][10], int boat) void positionBoat(int mat[10][10], int boat)
{ {
@ -247,10 +246,9 @@ void positionBoat(int mat[10][10], int boat)
} }
} }
/** /**
* Functions printMessage and printMessageScore * @brief Function printMessage
* Responsible for printing the score messages * Responsible for printing the auxiliary message
* @param msg -> return msg with board * @param msg prints msg with board
* @returns prints visual matrix
*/ */
void printMessage(char *msg) void printMessage(char *msg)
{ {
@ -260,6 +258,12 @@ void printMessage(char *msg)
printf("*\n"); printf("*\n");
printf("************************\n"); printf("************************\n");
} }
/**
* @brief Function printMessageScore
* Responsible for printing the score messages
* @param pts1 player 1 score
* @param pts2 player 2 score
*/
void printMessageScore(int pts1, int pts2) void printMessageScore(int pts1, int pts2)
{ {
printf("************************\n"); printf("************************\n");
@ -270,11 +274,11 @@ void printMessageScore(int pts1, int pts2)
printf("************************\n"); printf("************************\n");
} }
/** /**
* Function printTable * @brief Function printTable
* Responsible for printing the board * Responsible for printing the board
* @param logic -> return of the logical matrix * @param logic return of the logical matrix
* @param stage -> game step * @param stage game step
* @returns -> prints visual matrix * @returns char for visual matrix
*/ */
char printTable(int logic, int stage) char printTable(int logic, int stage)
{ {
@ -312,11 +316,10 @@ char printTable(int logic, int stage)
} }
} }
/** /**
* Function printsTray * @brief Function printsTray
* Responsible for printing the visual board for the user * Responsible for printing the visual board for the user
* @param mat -> Matrix * @param mat Matrix
* @param stage -> game step * @param stage game step
* @returns -> show board
*/ */
void printsTray(int mat[10][10], int stage) void printsTray(int mat[10][10], int stage)
{ {
@ -355,12 +358,11 @@ void printsTray(int mat[10][10], int stage)
} }
} }
/** /**
* Function shoot * @brief Function shoot
* Responsible for saying if he hit a boat * Responsible for saying if he hit a boat
* @param mat -> board * @param mat board
* @param line -> matrix row * @param line matrix row
* @param column -> matrix column * @param column matrix column
* @returns -> shoot function
*/ */
void shoot(int mat[10][10], int line, int column) void shoot(int mat[10][10], int line, int column)
{ {
@ -377,12 +379,12 @@ void shoot(int mat[10][10], int line, int column)
mat[line][column] = 30; mat[line][column] = 30;
} }
/** /**
* Function calculateScore * @brief Function calculateScore
* Responsible for calculating the score obtained during the game * Responsible for calculating the score obtained during the game
* @param mat -> board * @param mat board
* @param line -> matrix row * @param line matrix row
* @param column -> matrix column * @param column matrix column
* @returns -> calculate score * @returns resulting score
*/ */
int calculateScore(int mat[10][10], int line, int column) int calculateScore(int mat[10][10], int line, int column)
@ -548,13 +550,12 @@ int calculateScore(int mat[10][10], int line, int column)
return 0; return 0;
} }
/** /**
* Function printPositioning * @brief Function printPositioning
* Responsible for printing messages for positioning boats on the board; of * Responsible for printing messages for positioning boats on the board; of
* player 1 and 2 * player 1 and 2
* @param Player number representing the Player * @param Player number representing the Player
* @param boat number that represents the boat * @param boat number that represents the boat
* @param nm which message to print * @param nm which message to print
* @returns shows boat positioning messages
*/ */
void printPositioning(int Player, int boat, int nm) void printPositioning(int Player, int boat, int nm)
{ {