Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
puissance4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
anthony.bouillan
puissance4
Commits
d23f4ebe
Commit
d23f4ebe
authored
1 month ago
by
anthony.bouillan
Browse files
Options
Downloads
Patches
Plain Diff
Function comments update: column index correction
parent
fb7979ab
Branches
main
No related tags found
No related merge requests found
Pipeline
#39555
passed
1 month ago
Stage: build
Stage: test
Stage: clean
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/computer/computer.c
+2
-2
2 additions, 2 deletions
src/computer/computer.c
src/computer/computer.h
+2
-1
2 additions, 1 deletion
src/computer/computer.h
src/game/game.h
+2
-2
2 additions, 2 deletions
src/game/game.h
with
6 additions
and
5 deletions
src/computer/computer.c
+
2
−
2
View file @
d23f4ebe
...
...
@@ -57,9 +57,9 @@ int select_random_column(int number_of_columns, int number_of_rows, int** board)
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
++
)
{
if
(
board
[
i
][
x
]
==
EMPTY
)
{
if
(
board
[
i
][
col
]
==
EMPTY
)
{
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/computer/computer.h
+
2
−
1
View file @
d23f4ebe
...
...
@@ -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).
*
* @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 board The current game board.
* @return true if the column is full, false otherwise.
*/
bool
is_column_full
(
int
col
,
int
rows
,
int
**
board
);
#endif
This diff is collapsed.
Click to expand it.
src/game/game.h
+
2
−
2
View file @
d23f4ebe
...
...
@@ -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.
*
* @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.
* @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);
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.
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment