Skip to content
Snippets Groups Projects
Commit d23f4ebe authored by anthony.bouillan's avatar anthony.bouillan
Browse files

Function comments update: column index correction

parent fb7979ab
No related branches found
No related tags found
No related merge requests found
Pipeline #39555 passed
...@@ -57,9 +57,9 @@ int select_random_column(int number_of_columns, int number_of_rows, int** board) ...@@ -57,9 +57,9 @@ int select_random_column(int number_of_columns, int number_of_rows, int** board)
return robot_selected_column; return robot_selected_column;
} }
bool is_column_full(int x, int rows, int** board) { bool is_column_full(int col, int rows, int** board) {
for (int i = 0; i < rows; i++) { for (int i = 0; i < rows; i++) {
if (board[i][x] == EMPTY) { if (board[i][col] == EMPTY) {
return false; return false;
} }
} }
......
...@@ -32,10 +32,11 @@ int select_smart_column(int number_of_columns, int number_of_rows, int** board); ...@@ -32,10 +32,11 @@ int select_smart_column(int number_of_columns, int number_of_rows, int** board);
/** /**
* @brief Checks whether a column is full (i.e., no empty slots). * @brief Checks whether a column is full (i.e., no empty slots).
* *
* @param col The column index to check. * @param col The column index to check. starting from 0.
* @param rows The number of rows in the board. * @param rows The number of rows in the board.
* @param board The current game board. * @param board The current game board.
* @return true if the column is full, false otherwise. * @return true if the column is full, false otherwise.
*/ */
bool is_column_full(int col, int rows, int** board); bool is_column_full(int col, int rows, int** board);
#endif #endif
...@@ -52,7 +52,7 @@ void place_token(int player, struct coordinate coordinate, int** board); ...@@ -52,7 +52,7 @@ void place_token(int player, struct coordinate coordinate, int** board);
/** /**
* @brief Checks if the given column index is valid for the board. * @brief Checks if the given column index is valid for the board.
* *
* @param column The column index to check: indexed from 1. * @param column The column index to check. starting from 0.
* @param col_count The total number of columns in the board. * @param col_count The total number of columns in the board.
* @return true if the column index is valid, false otherwise. * @return true if the column index is valid, false otherwise.
*/ */
...@@ -101,7 +101,7 @@ bool is_human_turn(enum GAME_MODE game_mode, int current_turn); ...@@ -101,7 +101,7 @@ bool is_human_turn(enum GAME_MODE game_mode, int current_turn);
int get_ai_move(enum GAME_MODE game_mode, int col_count, int row_count, int** board); int get_ai_move(enum GAME_MODE game_mode, int col_count, int row_count, int** board);
/** /**
* @brief Gets column input from the player. * @brief Gets column input from the player and adjusts for 0-based indexing.
* *
* @return The column number entered by the player. * @return The column number entered by the player.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment