summaryrefslogtreecommitdiff
path: root/include/othello_move.h
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2022-01-21 17:20:17 -0500
committerRobby Zambito <contact@robbyzambito.me>2022-01-21 17:20:17 -0500
commitf1a4b5757f0d20739270b22726ebf8442b13cb50 (patch)
tree93e170ddebc79cf5a41777fc040797bc6dfa5d85 /include/othello_move.h
parent3a85be307b6240525f032b9fad5114bdf172bdc1 (diff)
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.
Diffstat (limited to 'include/othello_move.h')
-rw-r--r--include/othello_move.h8
1 files changed, 8 insertions, 0 deletions
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);