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 /include | |
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 'include')
-rw-r--r-- | include/othello.h | 2 | ||||
-rw-r--r-- | include/othello_move.h | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/include/othello.h b/include/othello.h index 56745bb..de4f846 100644 --- a/include/othello.h +++ b/include/othello.h @@ -52,6 +52,6 @@ void print_board(void); enum player_color get_current_player(void); // Returns the current board. -const enum player_color **get_board(void); +enum player_color **get_board(void); enum player_color get_winner(void); diff --git a/include/othello_move.h b/include/othello_move.h index 0bab641..377a27f 100644 --- a/include/othello_move.h +++ b/include/othello_move.h @@ -23,6 +23,7 @@ #include "othello.h" struct move prompt_get_move(enum player_color current_player); +struct move get_scm_move(FILE *strategy); // True if move is valid for current_player. // Otherwise false. @@ -34,4 +35,5 @@ bool is_valid_move(const enum player_color current_player, bool has_valid_moves(const enum player_color current_player); /* Returns true if the move was valid */ -bool apply_move(enum player_color current_player, struct move move); +bool apply_move(enum player_color **board, enum player_color current_player, + struct move move); |