liberty work
This commit is contained in:
parent
3fc0e0f89e
commit
b755309766
|
@ -114,6 +114,14 @@
|
||||||
:initform 0
|
:initform 0
|
||||||
:accessor rank-top-count)))
|
: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)
|
(defun insert (list comp var)
|
||||||
(if (funcall comp (car list) var)
|
(if (funcall comp (car list) var)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(in-package :go-bot)
|
(in-package :go-bot)
|
||||||
|
|
||||||
(defparameter *name* "fink")
|
(defparameter *name* "fink")
|
||||||
(defparameter *version* "0.2.0")
|
(defparameter *version* "0.3.0-dev")
|
||||||
(defparameter *author* "Dan Ballard")
|
(defparameter *author* "Dan Ballard")
|
||||||
|
|
||||||
(defparameter *default-komi* 5.5)
|
(defparameter *default-komi* 5.5)
|
||||||
|
|
6
gtp.lisp
6
gtp.lisp
|
@ -17,9 +17,9 @@
|
||||||
(do ()
|
(do ()
|
||||||
((or (eql socket nil) (eql *quit?* t)))
|
((or (eql socket nil) (eql *quit?* t)))
|
||||||
(let ((cmd (netpipe:tcp-read socket)))
|
(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))))
|
(let ((resp (inc-cpu-timer (dispatch-gtp-command cmd))))
|
||||||
(print resp)
|
;(print resp)
|
||||||
(netpipe:tcp-print socket (concatenate 'string "= " resp (string #\newline) (string #\newline))))))))))
|
(netpipe:tcp-print socket (concatenate 'string "= " resp (string #\newline) (string #\newline))))))))))
|
||||||
|
|
||||||
(defmacro inc-cpu-timer (body)
|
(defmacro inc-cpu-timer (body)
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
(progn (push (subseq string beg i) strings) (setf beg (+ i 1))))))
|
(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)
|
(defun match-string (str)
|
||||||
(lambda (elem) (string-equal str elem)))
|
(lambda (elem) (string-equal str elem)))
|
||||||
|
|
|
@ -27,12 +27,20 @@
|
||||||
(:use :common-lisp
|
(:use :common-lisp
|
||||||
:macro-utils)
|
:macro-utils)
|
||||||
(:export :basic-board
|
(:export :basic-board
|
||||||
|
:ranked-board
|
||||||
:get-stone
|
:get-stone
|
||||||
:set-stone
|
:set-stone
|
||||||
:coord-to-str
|
:coord-to-str
|
||||||
:str-to-coord
|
:str-to-coord
|
||||||
:genmove))
|
:genmove))
|
||||||
|
|
||||||
|
(defpackage liberty-shape
|
||||||
|
(:use :common-lisp
|
||||||
|
:macro-utils
|
||||||
|
:board)
|
||||||
|
(:export :liberty-board))
|
||||||
|
|
||||||
|
|
||||||
(defpackage go-bot
|
(defpackage go-bot
|
||||||
(:use :common-lisp
|
(:use :common-lisp
|
||||||
:board)
|
:board)
|
||||||
|
|
Loading…
Reference in New Issue