From f1a4b5757f0d20739270b22726ebf8442b13cb50 Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Fri, 21 Jan 2022 17:20:17 -0500 Subject: Fleshed out Scheme primitives * Moved board specific functions from othello.h to new othello_board.h * Removed unused function pointer for player moves * Added prototypes in headers for SCM functions, including scm_get_current_player, * Made get_winner accept a board and current player. This is useful for predictions to see if some move would make the other player a winner. * get_winner also writes the players scores to provided pointers. --- include/othello_move.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/othello_move.h') diff --git a/include/othello_move.h b/include/othello_move.h index 281cb9b..2e2974b 100644 --- a/include/othello_move.h +++ b/include/othello_move.h @@ -30,6 +30,9 @@ struct move get_scm_move(char *strategy_path); bool is_valid_move(enum player_color **board, const enum player_color current_player, const struct move move); +SCM scm_is_valid_move(SCM board, SCM current_player, SCM move); + +SCM scm_valid_moves(SCM scm_board, SCM player); // True if current_player has any valid moves. // Otherwise false. @@ -39,3 +42,8 @@ bool has_valid_moves(enum player_color **board, /* Returns true if the move was valid */ bool apply_move(enum player_color **board, enum player_color current_player, struct move move); +// Does not actually modify the current board state. Returns a new board with +// the move applied. If the move was not valid, an empty list (nil) is returned. +SCM scm_apply_move(SCM move, SCM board, SCM current_player); + +struct move scm_move_to_c_move(SCM scm_move); -- cgit v1.2.3