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. --- strategies/first-valid-move.scm | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'strategies') diff --git a/strategies/first-valid-move.scm b/strategies/first-valid-move.scm index e9a9bfb..e682873 100644 --- a/strategies/first-valid-move.scm +++ b/strategies/first-valid-move.scm @@ -1,25 +1,3 @@ -(use-modules (ice-9 pretty-print) - (srfi srfi-1)) - -(define (make-point row col) - (cons row col)) - -(define (point->row point) - (car point)) - -(define (point->col point) - (cdr point)) - -(define (valid-move-current-board? move) - (valid-move? (get-board) (current-player) move)) - -(define all-spots - (concatenate - (map (lambda (row) (map (lambda (col) (make-point row col)) (iota 8))) - (iota 8)))) - -(define valid-next-moves - (filter valid-move-current-board? all-spots)) - +(use-modules (srfi srfi-1)) ; Return the first valid move we find. -(first valid-next-moves) +(first (valid-moves)) -- cgit v1.2.3