diff options
author | Robby Zambito <contact@robbyzambito.me> | 2022-01-05 22:50:17 -0500 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2022-01-05 22:50:17 -0500 |
commit | 75607010bb4b095bc362c576927f7a7293514722 (patch) | |
tree | 8a92ca99137c7483fd15c3e7586b0d749d8eb45b /src/game_loop.c | |
parent | 58324035132009869c406d486605be98725c83f1 (diff) |
Make apply_move accept a board as a parameter.
This was how it originally was, but I changed it to use a global
variable instead. I want to be able to use the apply_move function in
the is_valid_move implementation, to have all the logic for checking if
a move is valid in one place.
Moved the apply_move function out of board.c, since it no longer
needs a direct reference to the board.
Diffstat (limited to 'src/game_loop.c')
-rw-r--r-- | src/game_loop.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/game_loop.c b/src/game_loop.c index 22c624e..26cb988 100644 --- a/src/game_loop.c +++ b/src/game_loop.c @@ -68,8 +68,9 @@ enum player_color game_loop(FILE *player_one_strategy, #define other_player (current_player == WHITE ? BLACK : WHITE) while (has_valid_moves(current_player)) { - struct move move = prompt_get_move(current_player); - if (apply_move(current_player, move)) { + struct move move = current_player_move(current_player, player_one_strategy, + player_two_strategy); + if (apply_move(get_board(), current_player, move)) { current_player = other_player; } } |