diff options
author | Robby Zambito <contact@robbyzambito.me> | 2021-07-25 23:52:42 -0400 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2021-07-25 23:52:42 -0400 |
commit | 0642443e690b879e94b627597f624d5fd56db33d (patch) | |
tree | e521d2f1d8671e5204b68f3f9c5f131cc5fefe71 | |
parent | f590189d63bac985c2738c63fc79a03f6ced1126 (diff) |
Return player_color from game_loop rather than char.
The player_color type already is set to char, but this is a bit clearer
as to what the actual return values are
-rw-r--r-- | cmd/main.c | 2 | ||||
-rw-r--r-- | include/othello.h | 2 | ||||
-rw-r--r-- | src/game_loop.c | 2 |
3 files changed, 3 insertions, 3 deletions
@@ -9,7 +9,7 @@ int main(int argc, char **argv) { player_color board[8][8]; initialize_board(board); - char winner = game_loop(board); + player_color winner = game_loop(board); switch (winner) { case WHITE: diff --git a/include/othello.h b/include/othello.h index c7ed718..ed25b6d 100644 --- a/include/othello.h +++ b/include/othello.h @@ -15,5 +15,5 @@ bool is_valid_move(const player_color board[8][8], const player_color current_player, const struct move move); bool has_valid_moves(const player_color board[8][8], const player_color current_player); -char game_loop(player_color board[8][8]); +player_color game_loop(player_color board[8][8]); void print_board(const player_color board[8][8]); diff --git a/src/game_loop.c b/src/game_loop.c index 9cbd5e2..91350ec 100644 --- a/src/game_loop.c +++ b/src/game_loop.c @@ -151,7 +151,7 @@ static void apply_move(player_color board[8][8], player_color current_player, } } -char game_loop(player_color board[8][8]) { +player_color game_loop(player_color board[8][8]) { player_color current_player = WHITE; while (has_valid_moves(board, current_player)) { |