diff options
Diffstat (limited to 'src/move.c')
-rw-r--r-- | src/move.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -402,6 +402,18 @@ SCM scm_valid_moves(SCM scm_board, SCM player) { return result; } +SCM scm_new_move(SCM row, SCM col) { + return scm_cons(row, col); +} + +SCM scm_move_to_row(SCM move) { + return scm_car(move); +} + +SCM scm_move_to_col(SCM move) { + return scm_cdr(move); +} + struct move get_scm_move(char *strategy_path) { // Initialize move to an invalid move. struct move move = {-1, -1}; @@ -411,6 +423,9 @@ struct move get_scm_move(char *strategy_path) { scm_c_define_gsubr("get-board", 0, 0, 0, scm_get_board); scm_c_define_gsubr("current-player", 0, 0, 0, scm_get_current_player); scm_c_define_gsubr("other-player", 0, 0, 0, scm_get_other_player); + scm_c_define_gsubr("move", 2, 0, 0, scm_new_move); + scm_c_define_gsubr("move->row", 1, 0, 0, scm_move_to_row); + scm_c_define_gsubr("move->col", 1, 0, 0, scm_move_to_col); scm_c_define_gsubr("valid-move?", 1, 2, 0, scm_is_valid_move); scm_c_define_gsubr("valid-moves", 0, 2, 0, scm_valid_moves); scm_c_define_gsubr("apply-move", 1, 2, 0, scm_apply_move); |