r5107: Auto commit for Debian build
[reversi.git] / strategies.lisp
index e0e108d1d0ed1320b3c9d25b392570cc6bc82421..e3101405e0597b61cc60e6082b555d8db1bd9c5b 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;  Programer:      Kevin Rosenberg based on code by Peter Norvig
 ;;;;  Date Started:   1 Nov 2001
 ;;;;
-;;;; $Id: strategies.lisp,v 1.7 2003/06/12 13:08:43 kevin Exp $
+;;;; $Id: strategies.lisp,v 1.8 2003/06/12 13:28:55 kevin Exp $
 ;;;;
 ;;;; This file is Copyright (c) 2001-2003 by Kevin M. Rosenberg 
 ;;;; and Copyright (c) 1998-2002 Peter Norvig
 
 (defun negate-value (node)
   "Set the value of a node to its negative."
-  (declare (fixnum node)
-          (optimize (speed 3) (safety 0) (space 0)))
+  (declare (optimize (speed 3) (safety 0) (space 0)))
   (setf (node-value node) (- (node-value node)))
   node)
 
   (declare (type board board)
           (type player player)
           (type fixnum achievable cutoff ply)
-          (type move killer)
+          (type (or null move) killer)
           (optimize (speed 3) (safety 0) (space 0)))
   "A-B search, putting killer move first."
   (if (= ply 0)
 
 (defun alpha-beta-searcher3w (depth eval-fn)
   "Return a strategy that does A-B search with killer moves."
-  (declare (fixnum depth))
   #'(lambda (player board)
-      (multiple-value-bind (value move)
-          (alpha-beta3w player board losing-value winning-value
-                       depth eval-fn nil)
-        (declare (ignore value))
-        move)))
+      (nth-value 1
+                (alpha-beta3w player board losing-value winning-value
+                              depth eval-fn nil))))
 
 (defun put-first (killer moves)
   "Move the killer move to the front of moves,
 
 (defun iago (depth)
   "Use an approximation of Iago's evaluation function."
+  (declare (fixnum depth))
   (alpha-beta-searcher3 depth #'iago-eval))
 
 ;; Maximizer (1-ply)
 
 
 (defun ab3w-df (ply)
+  (declare (fixnum ply))
   (alpha-beta-searcher3w ply #'count-difference))
 
 (defun ab3w-wt (ply)
+  (declare (fixnum ply))
   (alpha-beta-searcher3w ply #'weighted-squares))
 
 (defun ab3w-md-wt (ply)
+  (declare (fixnum ply))
   (alpha-beta-searcher3w ply #'modified-weighted-squares))