blob: e9a9bfbfdc1860a67fe34b8dc4587048d533a34b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
(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)
|