X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=base.lisp;h=a6a79469ac7a9aa0c4cdd5e0e2aacdaddf3ebd9d;hb=062d6c95c94ac969bd49083dea184c9bb81d6fea;hp=cffba2edf75124612bd90cbffc3812830ad14337;hpb=7e4bfe37534bc2812d2cafabf8487bd165b2d952;p=reversi.git diff --git a/base.lisp b/base.lisp index cffba2e..a6a7946 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.5 2003/06/12 13:08:43 kevin Exp $ +;;;; $Id$ ;;;; ;;;; This file is Copyright (c) 2001-2002 by Kevin M. Rosenberg ;;;; and Copyright (c) 1998-2002 Peter Norvig @@ -77,7 +77,7 @@ (record-game? :type boolean :initarg :record-game? :documentation "Whether to record moves and clcck of this game" :reader record-game?) - (final-result :type fixnum :initarg :final-result + (final-result :type (or null fixnum) :initarg :final-result :documentation "Final count, is NIL while game in play" :accessor final-result) (max-minutes :type fixnum :initarg :max-minutes @@ -156,10 +156,10 @@ (defun count-difference (player board) "Count player's pieces minus opponent's pieces." (declare (type board board) - (fixnum player) + (type fixnum player) (optimize (speed 3) (safety 0) (space 0))) (the fixnum (- (the fixnum (count player board)) - (the fixum (count (opponent player) board))))) + (the fixnum (count (opponent player) board))))) (defun valid-p (move) (declare (type move move) @@ -185,8 +185,7 @@ (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)) @@ -281,7 +280,7 @@ (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." @@ -326,16 +325,9 @@ (loop for move in all-squares when (legal-p move player board) collect move)) -#-allegro (defun replace-board (to from) (replace to from)) -#+allegro -(defun replace-board (to from) - (declare (type board to from)) - (ff::fslot-memory-copy to 0 400 from) - to) - (defvar *ply-boards* (apply #'vector (loop repeat 40 collect (initial-board))))