(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)) ; Return the first valid move we find. (first valid-next-moves)