Fix types/initforms
[reversi.git] / io.lisp
diff --git a/io.lisp b/io.lisp
index 6a61dba21885ca3245a21e74c9182f47a20911b2..3de7a2aeb202a47f3bb6cd390ac5a6f07ed4befe 100644 (file)
--- a/io.lisp
+++ b/io.lisp
@@ -1,24 +1,32 @@
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: reversi -*-
 ;;;;***************************************************************************
 ;;;;
 ;;;; FILE IDENTIFICATION
-;;;; 
-;;;;  Name:           io.cl  
+;;;;
+;;;;  Name:           io.lisp
 ;;;;  Purpose:        Basic Input-Output for reversi
-;;;;  Programer:      Kevin M. Rosenberg, M.D.
+;;;;  Programer:      Kevin Rosenberg based on code by Peter Norvig
 ;;;;  Date Started:   1 Nov 2001
-;;;;  CVS Id:         $Id: io.lisp,v 1.1 2002/10/25 08:36:42 kevin Exp $
 ;;;;
+;;;; $Id$
+;;;;
+;;;; This file is Copyright (c) 2001-2003 by Kevin M. Rosenberg
+;;;; and Copyright (c) 1998-2002 Peter Norvig
+;;;;
+;;;; Reversi users are granted the rights to distribute and use this software
+;;;; as governed by the terms of the Lisp Lesser GNU Public License
+;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
 ;;;;***************************************************************************
 
-(in-package :reversi)
-(declaim (optimize (safety 1) (debug 3) (speed 3)))
+(in-package #:reversi)
 
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
-(let ((square-names 
+(let ((square-names
         (cross-product #'concat-symbol
                        '(? A B C D E F G H ?)
                        '(? 1 2 3 4 5 6 7 8 ?))))
+  (declare (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)
   (let (move-list)
     (dotimes (i (length moves))
       (push (format nil "~2d: ~a ~a~%"
-                   (1+ i)
-                   (title-of (nth 1 (elt moves i)))
-                   (symbol-name (88->h8 (nth 0 (elt moves i)))))
-           move-list))
+                    (1+ i)
+                    (title-of (nth 1 (elt moves i)))
+                    (symbol-name (88->h8 (nth 0 (elt moves i)))))
+            move-list))
     (setq move-list (nreverse move-list))
     (list-to-delimited-string move-list #\space))))
 
@@ -76,5 +84,5 @@
     (format nil "~2d:~2,'0d" min sec)))
 
 
-       
-    
+
+