diff options
-rw-r--r-- | src/board.c | 3 |
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); } |