summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2022-01-05 22:53:00 -0500
committerRobby Zambito <contact@robbyzambito.me>2022-01-05 22:53:00 -0500
commit6a9badff9bfbbdd7f54f018d3117c1778ecaa74e (patch)
tree2933cb994b9abb3d35f2a0bc1c794d7fa547bade
parent75607010bb4b095bc362c576927f7a7293514722 (diff)
Added comment
-rw-r--r--src/board.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/board.c b/src/board.c
index 6d4a35c..62171ff 100644
--- a/src/board.c
+++ b/src/board.c
@@ -54,6 +54,9 @@ enum player_color get_winner() {
int white_score = 0, black_score = 0;
for (int row = 0; row < 8; row++) {
for (int col = 0; col < 8; col++) {
+ // This takes advantage of the fact that the 1 is the same thing as a true,
+ // and 0 is the same thing as a false. This will count the number of white
+ // and black spaces.
white_score += (int)(board[row][col] == WHITE);
black_score += (int)(board[row][col] == BLACK);
}