X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=io-clim.lisp;h=79718dea0be0c376c43f730f759ce7c7ded8da63;hb=4c844bde197de54c0343f7ab500153278f859ec6;hp=3cd7f28c4d25a3eaa1a3ae3a6cb0fc83513195b2;hpb=b29c5d666cbd1d0c08d4da49b32e4ed41c6dabba;p=reversi.git diff --git a/io-clim.lisp b/io-clim.lisp index 3cd7f28..79718de 100644 --- a/io-clim.lisp +++ b/io-clim.lisp @@ -1,16 +1,25 @@ +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: reversi -*- ;;;;*************************************************************************** ;;;; ;;;; FILE IDENTIFICATION ;;;; -;;;; Name: io-clim.cl +;;;; Name: io-clim.lisp ;;;; Purpose: CLIM GUI for reversi -;;;; Programer: Kevin M. Rosenberg, M.D. +;;;; Programer: Kevin M. Rosenberg ;;;; Date Started: 1 Nov 2001 -;;;; CVS Id: $Id: io-clim.lisp,v 1.1 2002/10/25 08:36:42 kevin Exp $ ;;;; +;;;; $Id$ +;;;; +;;;; This file is Copyright (c) 2001-2003 by Kevin M. Rosenberg +;;;; +;;;; 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) +(in-package #:reversi) + +#+mcclim (shadowing-import 'clim-internals::stream-set-cursor-position) (defparameter cell-inner-width 40) (defparameter cell-inner-height 40) @@ -33,7 +42,7 @@ id name searcher eval ply strategy start-time searcher-id eval-id) -(defun make-gui-player (&key id name strategy searcher-id eval-id ply) +(defun make-gui-player (&key id name strategy searcher-id eval-id (ply 0)) (let ((p (make-gui-player-struct :id id :ply ply :name name :strategy strategy :searcher-id searcher-id :eval-id eval-id)) @@ -191,11 +200,11 @@ reversi-help-table) :menu (("Game" :menu reversi-game-table - :mnemonic #\G + :keystroke #\G :documentation "Game commands") ("Help" :menu reversi-help-table - :mnemonic #\H + :keystroke #\H :documentation "Help Commands")))) (:menu-bar t) (:layouts @@ -240,7 +249,7 @@ record stream state) state (multiple-value-bind (xoff yoff) - (convert-from-relative-to-absolute-coordinates + (clim::convert-from-relative-to-absolute-coordinates stream (output-record-parent record)) (with-bounding-rectangle* (left top right bottom) record (draw-rectangle* stream @@ -338,9 +347,13 @@ (format stream "Valid Moves~%~A" (list-to-delimited-string legal-moves #\space))))) (when (null (player game)) - (if (plusp (final-result game)) - (format stream "Black wins by ~d!" (final-result game)) - (format stream "White wins by ~d!" (- 0 (final-result game))))))))) + (cond + ((zerop (final-result game)) + (format stream "It's a draw!")) + ((plusp (final-result game)) + (format stream "Black wins by ~d!" (final-result game))) + (t + (format stream "White wins by ~d!" (- 0 (final-result game)))))))))) @@ -420,10 +433,7 @@ #-(and os-threads microsoft-32) nil)) -(defun g () - (greversi)) - -(defun greversi () +(defun clim-reversi () (unless (or *force* (null *reversi-frame*)) (setq *reversi-frame* (make-application-frame 'reversi))) (setq *reversi-frame* (run-frame 'reversi *reversi-frame*)))