;; --------------------------------------------- ;; John Paxton ;; August 26, 2007 ;; CS 436 ;; --------------------------------------------- ;; This file contains the driver functions for ;; the first programming assignment. The objective ;; of the assignment is to determine whether the ;; last stone played in a game of Gomoku creates a ;; run of 5 (or more) like-colored stones. ;; --------------------------------------------- (defconstant *empty* 'empty) ;; constant for empty square (defconstant *black* 'black) ;; constant for black stone (defconstant *white* 'white) ;; constant for white stone ;; --------------------------------------------- ;; test ;; --------------------------------------------- ;; This is function that should be called to ;; test the correctness of the solution. ;; --------------------------------------------- (defun test () (let ( (board (make-array '(19 19) :initial-element *empty*)) ;; Gomoku board ) (test-aux board 0 0 *white*) (test-aux board 0 1 *white*) (test-aux board 0 2 *white*) (test-aux board 0 5 *white*) (test-aux board 0 4 *white*) (test-aux board 0 3 *white*) (test-aux board 0 6 *white*) (test-aux board 5 5 *black*) ) ) ;; --------------------------------------------- ;; test-aux ;; --------------------------------------------- ;; board : Gomoku board ;; x : x coordinate of last stone played ;; y : y coordinate of last stone played ;; color : color of last stone played ;; --------------------------------------------- ;; Play a stone in the appropriate position and ;; the call five-in-a-row-p to determine whether ;; the game is won. ;; --------------------------------------------- (defun test-aux (board x y color) (setf (aref board x y) color) (if (five-in-row-p board x y) (format t "Win for ~a playing at (~a, ~a)~%" color x y) ) )