diff options
author | Robby Zambito <contact@robbyzambito.me> | 2022-01-18 22:37:04 -0500 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2022-01-18 22:37:04 -0500 |
commit | c5c54396bdf8ef14c17a0bc5b8f0fda74aa958cf (patch) | |
tree | 55354c468cb60d52578f70b892f3f8ac885d6c2c /src/game_loop.c | |
parent | 59627145631f254191ce1b9de561c8ba0ddc889e (diff) |
* Made print_board accept a board to print.
* free_board should not return anything.
* is_valid_move and has_valid_moves accept a board.
* Implemented primitives for Scheme strategies to get the current
player, and to get the board, and the validity of a move.
* Removed game logic from is_valid_move. Instead simply apply the move
to a temp board, and see if the move worked.
* Created a very simple strategy for testing these primitives. It only
hardcodes the first move, and then fails since that move is no longer
valid.
Diffstat (limited to 'src/game_loop.c')
-rw-r--r-- | src/game_loop.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/game_loop.c b/src/game_loop.c index 67c9ea0..8186623 100644 --- a/src/game_loop.c +++ b/src/game_loop.c @@ -67,9 +67,9 @@ enum player_color game_loop(char *player_one_strategy_path, current_player = WHITE; #define other_player (current_player == WHITE ? BLACK : WHITE) - while (has_valid_moves(current_player)) { - struct move move = current_player_move(current_player, player_one_strategy_path, - player_two_strategy_path); + while (has_valid_moves(get_board(), current_player)) { + struct move move = current_player_move( + current_player, player_one_strategy_path, player_two_strategy_path); if (apply_move(get_board(), current_player, move)) { current_player = other_player; } |