;;;; Programer: Kevin Rosenberg based on code by Peter Norvig
;;;; Date Started: 1 Nov 2001
;;;;
-;;;; $Id: base.lisp,v 1.5 2003/06/12 13:08:43 kevin Exp $
+;;;; $Id: base.lisp,v 1.6 2003/06/12 13:28:55 kevin Exp $
;;;;
;;;; This file is Copyright (c) 2001-2002 by Kevin M. Rosenberg
;;;; and Copyright (c) 1998-2002 Peter Norvig
(declare (type board board)
(type move move)
(type player player)
- (optimize speed (safety 0))
-)
+ (optimize speed (safety 0) (space 0)))
(if (= (bref board move) empty)
(block search
(let ((i 0))
(let ((c (+ move dir)))
(declare (type square c))
(and (= (the piece (bref board c)) (the player (opponent player)))
- (find-bracketing-piece (+ c dir) player board dir))))
+ (find-bracketing-piece (the fixnum (+ c dir)) player board dir))))
(defun find-bracketing-piece (square player board dir)
"Return the square number of the bracketing piece."
+cl-reversi (1.0.7-1) unstable; urgency=low
+
+ * New upstream
+
+ -- Kevin M. Rosenberg <kmr@debian.org> Thu, 12 Jun 2003 07:28:39 -0600
+
cl-reversi (1.0.6-1) unstable; urgency=low
* New upstream
;;;; Programer: Kevin M. Rosenberg based on code by Peter Norvig
;;;; Date Started: 1 Nov 2001
;;;;
-;;;; $Id: edge-table.lisp,v 1.4 2003/06/12 12:42:13 kevin Exp $
+;;;; $Id: edge-table.lisp,v 1.5 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
(eval-when (:compile-toplevel :load-toplevel :execute)
(let ((stable 0) (semi-stable 1) (unstable 2))
- (declaim (type fixnum stable semi-stable unstable))
+ (declare (type fixnum stable semi-stable unstable))
(defun piece-stability (board sq)
(declare (type board board)
;;;; Programer: Kevin Rosenberg based on code by Peter Norvig
;;;; Date Started: 1 Nov 2001
;;;;
-;;;; $Id: io.lisp,v 1.4 2003/06/12 12:42:13 kevin Exp $
+;;;; $Id: io.lisp,v 1.5 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
(cross-product #'concat-symbol
'(? A B C D E F G H ?)
'(? 1 2 3 4 5 6 7 8 ?))))
+ (declaim (type list square-names))
(defun h8->88 (str)
"Convert from alphanumeric to numeric square notation."
(defun 88->h8 (num)
"Convert from numeric to alphanumeric square notation."
(if (valid-p num)
- (elt square-names num)
+ (nth num square-names)
num)))
(defun moves-to-string (moves)
;;;; 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))