From: Kevin M. Rosenberg Date: Wed, 2 Apr 2014 16:22:26 +0000 (-0600) Subject: Apply single float patch from Faré X-Git-Tag: v1.0.15~1 X-Git-Url: http://git.kpe.io/?p=reversi.git;a=commitdiff_plain;h=ec433bb239841519fc1547f5b2de220150e9c641 Apply single float patch from Faré --- diff --git a/edge-table.lisp b/edge-table.lisp index 524fbcb..c11e7b3 100644 --- a/edge-table.lisp +++ b/edge-table.lisp @@ -80,7 +80,7 @@ (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))) @@ -124,19 +124,19 @@ (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))) @@ -149,19 +149,19 @@ (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)))))