(type square index))
(combine-edge-moves
(cons
- (list 1.0 (aref *edge-table* index)) ;; no move
+ (list 1f0 (aref *edge-table* index)) ;; no move
(loop for sq in *top-edge* ;; possible moves
when (= (bref board sq) empty)
collect (possible-edge-move player board sq)))
(declare (type player player)
(list possibilities)
(optimize (speed 3) (safety 0) (space 0)))
- (let ((prob 1.0)
- (val 0.0)
+ (let ((prob 1f0)
+ (val 0f0)
(fn (if (= player black) #'> #'<)))
(declare (short-float prob val))
(loop for pair in (sort possibilities fn :key #'second)
- while (>= prob 0.0)
+ while (>= prob 0f0)
do (incf val (* prob (first pair) (second pair)))
(decf prob (* prob (first pair))))
(round val)))
(eval-when (:compile-toplevel :load-toplevel :execute)
- (let ((corner/xsqs '((11 . 22) (18 . 27) (81. 72) (88 . 77))))
+ (let ((corner/xsqs '((11 . 22) (18 . 27) (81 . 72) (88 . 77))))
(defun corner-p (sq) (assoc sq corner/xsqs))
(defun x-square-p (sq) (rassoc sq corner/xsqs))
(defun x-square-for (corner) (cdr (assoc corner corner/xsqs)))
(type square square)
(optimize (speed 3) (safety 0) (space 0)))
(cond
- ((x-square-p square) .5) ;; X-squares
- ((legal-p square player board) 1.0) ;; immediate capture
+ ((x-square-p square) 5f-1) ;; X-squares
+ ((legal-p square player board) 1f0) ;; immediate capture
((corner-p square) ;; move to corner depends on X-square
(let ((x-sq (x-square-for square)))
(declare (type square x-sq))
(cond
- ((= (bref board x-sq) empty) .1)
- ((= (bref board x-sq) player) 0.001)
- (t .9))))
+ ((= (bref board x-sq) empty) 1f-1)
+ ((= (bref board x-sq) player) 1f-4)
+ (t 9f-1))))
(t (/ (aref
- '#2A((.1 .4 .7)
- (.05 .3 *)
- (.01 * *))
+ '#2A((1f-1 4f-1 7f-1)
+ (5f-2 3f-1 *)
+ (1f-2 * *))
(count-edge-neighbors player board square)
(count-edge-neighbors (opponent player) board square))
(if (legal-p square (opponent player) board) 2 1)))))