From 7e4bfe37534bc2812d2cafabf8487bd165b2d952 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 12 Jun 2003 13:08:43 +0000 Subject: [PATCH] r5105: Auto commit for Debian build --- base.lisp | 12 ++++++++---- debian/changelog | 6 ++++++ strategies.lisp | 15 +++++++-------- utils.lisp | 7 ++++--- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/base.lisp b/base.lisp index bbcd872..cffba2e 100644 --- a/base.lisp +++ b/base.lisp @@ -8,7 +8,7 @@ ;;;; Programer: Kevin Rosenberg based on code by Peter Norvig ;;;; Date Started: 1 Nov 2001 ;;;; -;;;; $Id: base.lisp,v 1.4 2003/06/12 12:42:13 kevin Exp $ +;;;; $Id: base.lisp,v 1.5 2003/06/12 13:08:43 kevin Exp $ ;;;; ;;;; This file is Copyright (c) 2001-2002 by Kevin M. Rosenberg ;;;; and Copyright (c) 1998-2002 Peter Norvig @@ -100,8 +100,10 @@ :clock (make-clock +default-max-minutes+))) -(defun name-of (piece) (char ".@O?" piece)) -(defun title-of (piece) (nth (1- piece) '("Black" "White")) ) +(defun name-of (piece) (schar ".@O?" piece)) +(defun title-of (piece) + (declare (fixnum piece)) + (nth (the fixnum (1- piece)) '("Black" "White")) ) (defmacro opponent (player) `(if (= ,player black) white black)) @@ -110,7 +112,9 @@ `(the piece (aref (the board ,board) (the square ,square)))) (defparameter all-squares - (loop for i fixum from 11 to 88 when (<= 1 (mod i 10) 8) collect i) + (loop for i fixnum from 11 to 88 + when (<= 1 (the fixnum (mod i 10)) 8) + collect i) "A list of all squares") (defun initial-board () diff --git a/debian/changelog b/debian/changelog index 77378cf..f02f032 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-reversi (1.0.6-1) unstable; urgency=low + + * New upstream + + -- Kevin M. Rosenberg Thu, 12 Jun 2003 07:08:34 -0600 + cl-reversi (1.0.5-1) unstable; urgency=low * Improve .asd file diff --git a/strategies.lisp b/strategies.lisp index c2cade7..e0e108d 100644 --- a/strategies.lisp +++ b/strategies.lisp @@ -8,7 +8,7 @@ ;;;; Programer: Kevin Rosenberg based on code by Peter Norvig ;;;; Date Started: 1 Nov 2001 ;;;; -;;;; $Id: strategies.lisp,v 1.6 2003/06/12 12:42:13 kevin Exp $ +;;;; $Id: strategies.lisp,v 1.7 2003/06/12 13:08:43 kevin Exp $ ;;;; ;;;; This file is Copyright (c) 2001-2003 by Kevin M. Rosenberg ;;;; and Copyright (c) 1998-2002 Peter Norvig @@ -24,8 +24,7 @@ "Make any legal move." (declare (type player player) (type board board)) - (random-elt (legal-moves player board))) - + (random-nth (legal-moves player board))) (defun maximize-difference (player board) "A strategy that maximizes the difference in pieces." @@ -286,7 +285,7 @@ (defun negate-value (node) "Set the value of a node to its negative." (declare (fixnum node) - (speed 3) (safety 0) (space 0)) + (optimize (speed 3) (safety 0) (space 0))) (setf (node-value node) (- (node-value node))) node) @@ -401,6 +400,7 @@ (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 @@ -455,10 +455,9 @@ "Total edge evaluation for player to move on board." (declare (type board board) (type player player) - (optimize (speed 3) (safety 0) (space 0)) - (loop for edge-list in *edge-and-x-lists* - sum (aref *edge-table* - (edge-index player board edge-list)))) + (optimize (speed 3) (safety 0) (space 0))) + (loop for edge-list of-type (simple-array fixnum (*)) in *edge-and-x-lists* + sum (aref *edge-table* (edge-index player board edge-list)))) (defun iago-eval (player board) "Combine edge-stability, current mobility and diff --git a/utils.lisp b/utils.lisp index 8a3ac40..8cd387d 100644 --- a/utils.lisp +++ b/utils.lisp @@ -7,7 +7,7 @@ ;;;; Programer: Kevin M. Rosenberg ;;;; Date Started: 1 Nov 2001 ;;;; -;;;; $Id: utils.lisp,v 1.5 2003/06/12 12:42:13 kevin Exp $ +;;;; $Id: utils.lisp,v 1.6 2003/06/12 13:08:43 kevin Exp $ ;;;; ;;;; This file is Copyright (c) 2001-2003 by Kevin M. Rosenberg ;;;; @@ -42,9 +42,10 @@ Like mapcon, but uses append instead of nconc." (apply #'append (mapcar fn list))) -(defun random-elt (seq) +(defun random-nth (seq) + (declare (list seq)) "Pick a random element out of a sequence." - (elt seq (random (length seq)))) + (nth (random (length seq)) nth)) (defun concat-symbol (&rest args) "Concatenate symbols or strings to form an interned symbol" -- 2.34.1