summaryrefslogtreecommitdiff
path: root/strategies/first-move.scm
blob: 7c890785c8dcd8a7f40dde53da3bd106f558620c (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
26
27
28
29
30
31
32
33
34
(use-modules (ice-9 pretty-print)
             (srfi srfi-1))

;(pretty-print (get-board))
;(newline)

(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))))

(display "All valid moves: ")
(for-each (lambda (valid-move) (display valid-move) (newline))
          (filter valid-move-current-board? all-spots))
(newline)

; Does not work yet
(display (valid-moves (get-board) (current-player)))
(newline)

; The last value is simply used as the move
(make-point 3 2)