most basic working client functionality

This commit is contained in:
Dan 2008-05-05 08:39:04 -07:00
parent 54ce7b3e58
commit 38a2a0cccf
3 changed files with 27 additions and 7 deletions

View File

@ -1,5 +1,9 @@
(in-package :go-bot)
(defparameter *name* "gobot")
(defparameter *version* "0.01")
(defparameter *author* "Dan Ballard")
(defun make-board (size)
(make-array size :initial-element (make-array size :initial-element nil)))

View File

@ -1,8 +1,11 @@
(in-package :gtp-handler)
(defparameter *quit?* nil)
(defun gtp-client ()
(do ((quit? nil))
((eql quit? t))
(setf *quit?* nil)
(do ()
((eql *quit?* t))
(format t "= ~a~%~%" (dispatch-gtp-command (read-line t)))))
(defun split-string (string pivot-str)
@ -17,11 +20,21 @@
(defun dispatch-gtp-command (command-string)
(let* ((commands (split-string (string-downcase command-string) " "))
(let* ((commands (cl-ppcre:split "\\s+" (string-upcase command-string)))
(command (intern (first commands))))
(progn (format t "'~a'~%" command)
(case command
(name "GoBot")
(version "0.1")
(name go-bot:*name*)
(version go-bot:*version*)
;(boardsize (progn
; (go-bot:set-boardsize (parse-integer (second commands)))
; (go-bot:init-board)))
;(komi (go-bot:set-komi (parse-integer (second commands))))
;(clearboard (go-bot:init)
;(play (go-bot:play (second commands) (third commands)))
;(genmove (go-bot:genmove (char (second commands) 0)))
;(known_command)
;(list_commands
(quit (progn (setf *quit?* t)) "")
(otherwise (concatenate 'string "Unkown command '" (first commands) "'"))))))

View File

@ -4,7 +4,10 @@
(defpackage gtp-handler
(:use :common-lisp)
(:export gtp-client))
(:export :gtp-client))
(defpackage go-bot
(:use :common-lisp))
(:use :common-lisp)
(:export :*name*
:*version*
:*author*))