liberty work

This commit is contained in:
Dan 2008-05-26 17:46:43 -07:00
parent 3fc0e0f89e
commit b755309766
4 changed files with 20 additions and 4 deletions

View File

@ -114,6 +114,14 @@
:initform 0
:accessor rank-top-count)))
(defmacro copy-slots (slots src dst)
`(progn ,@(loop for slot in slots collect `(setf (,slot ,src) (,slot ,dst)))))
(defmethod initialize-instance :after ((board ranked-board) &key from-board)
(if (eql from-board nil)
(setf (rank-highest board) (rank-highest from-board))
(defun insert (list comp var)
(if (funcall comp (car list) var)

View File

@ -1,7 +1,7 @@
(in-package :go-bot)
(defparameter *name* "fink")
(defparameter *version* "0.2.0")
(defparameter *version* "0.3.0-dev")
(defparameter *author* "Dan Ballard")
(defparameter *default-komi* 5.5)

View File

@ -17,9 +17,9 @@
(do ()
((or (eql socket nil) (eql *quit?* t)))
(let ((cmd (netpipe:tcp-read socket)))
(format t "cmd: '~a'~%'" cmd)
;(format t "cmd: '~a'~%'" cmd)
(let ((resp (inc-cpu-timer (dispatch-gtp-command cmd))))
(print resp)
;(print resp)
(netpipe:tcp-print socket (concatenate 'string "= " resp (string #\newline) (string #\newline))))))))))
(defmacro inc-cpu-timer (body)
@ -46,7 +46,7 @@
(progn (push (subseq string beg i) strings) (setf beg (+ i 1))))))
(defparameter *supported_commands* '("name" "version" "protocol_version" "komi" "boardsize" "clear_board" "play" "genmove" "cputime" "quit" "game_score" "lisT_commands" "known_command"))
(defparameter *supported_commands* '("name" "version" "protocol_version" "komi" "boardsize" "clear_board" "play" "genmove" "cputime" "quit" "game_score" "list_commands" "known_command"))
(defun match-string (str)
(lambda (elem) (string-equal str elem)))

View File

@ -27,12 +27,20 @@
(:use :common-lisp
:macro-utils)
(:export :basic-board
:ranked-board
:get-stone
:set-stone
:coord-to-str
:str-to-coord
:genmove))
(defpackage liberty-shape
(:use :common-lisp
:macro-utils
:board)
(:export :liberty-board))
(defpackage go-bot
(:use :common-lisp
:board)