most basic working client functionality
This commit is contained in:
parent
54ce7b3e58
commit
38a2a0cccf
|
@ -1,5 +1,9 @@
|
||||||
(in-package :go-bot)
|
(in-package :go-bot)
|
||||||
|
|
||||||
|
(defparameter *name* "gobot")
|
||||||
|
(defparameter *version* "0.01")
|
||||||
|
(defparameter *author* "Dan Ballard")
|
||||||
|
|
||||||
(defun make-board (size)
|
(defun make-board (size)
|
||||||
(make-array size :initial-element (make-array size :initial-element nil)))
|
(make-array size :initial-element (make-array size :initial-element nil)))
|
||||||
|
|
||||||
|
|
23
gtp.lisp
23
gtp.lisp
|
@ -1,8 +1,11 @@
|
||||||
(in-package :gtp-handler)
|
(in-package :gtp-handler)
|
||||||
|
|
||||||
|
(defparameter *quit?* nil)
|
||||||
|
|
||||||
(defun gtp-client ()
|
(defun gtp-client ()
|
||||||
(do ((quit? nil))
|
(setf *quit?* nil)
|
||||||
((eql quit? t))
|
(do ()
|
||||||
|
((eql *quit?* t))
|
||||||
(format t "= ~a~%~%" (dispatch-gtp-command (read-line t)))))
|
(format t "= ~a~%~%" (dispatch-gtp-command (read-line t)))))
|
||||||
|
|
||||||
(defun split-string (string pivot-str)
|
(defun split-string (string pivot-str)
|
||||||
|
@ -17,11 +20,21 @@
|
||||||
|
|
||||||
|
|
||||||
(defun dispatch-gtp-command (command-string)
|
(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))))
|
(command (intern (first commands))))
|
||||||
(progn (format t "'~a'~%" command)
|
(progn (format t "'~a'~%" command)
|
||||||
(case command
|
(case command
|
||||||
(name "GoBot")
|
(name go-bot:*name*)
|
||||||
(version "0.1")
|
(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) "'"))))))
|
(otherwise (concatenate 'string "Unkown command '" (first commands) "'"))))))
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
|
|
||||||
(defpackage gtp-handler
|
(defpackage gtp-handler
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:export gtp-client))
|
(:export :gtp-client))
|
||||||
|
|
||||||
(defpackage go-bot
|
(defpackage go-bot
|
||||||
(:use :common-lisp))
|
(:use :common-lisp)
|
||||||
|
(:export :*name*
|
||||||
|
:*version*
|
||||||
|
:*author*))
|
Loading…
Reference in New Issue