130 likes | 149 Views
Explore the GTP protocol basics for developing Go engines, covering board setup, move generation, and state variables.
E N D
Zhou ZhengZhong 2015/11/12 Course Project Introduction
GTP Model Controller GTP Another Engine Engine OR Human
gtp2-spec-draft2.pdf GTP – Go Text Protocol http://www.lysator.liu.se/~gunnar/gtp/ GoGui http://gogui.sourceforge.net/ gogui-1.4.9-install.exe
GTP Basics Engine Preprocessing Section 3.1 Section 2 Remove all occurences of CR and other control characters except for HT and LF For each line with a hash sign (#), remove all text following and including this character. Convert all occurences of HT to SPACE Discard any empty or white-space only lines Character Set Control Characters Whitespace Newline Convention
Protocol Details Section 3.3-3.5 Command {id} command_name {arguments}\n Success Response ={id} {response}\n\n Failure Response ?{id} error_message\n\n Standard Error Message unknown command
Board Coordinates Letter + Number, board size 13x13 Left->Right: A~M(excluding I) Bottom->Top: 1~13 vertex “B13”, “j11” or “pass” color “white” or “w” to denote white, or “black” or “b” to denote black. Colors are not case sensitive. move the combination of one color and one vertex, separated by space. Moves are not case sensitive “white h10”, “B F5”, “w pass”.
Brown(Almost random) brown-1.0.tar.gz Simple example with basic framework brown.c Go board logic and move generation gtp.c gtp.h GTP support code interface.c GTP interface code and main() function
State Variables An engine is expected to keep track of the following state information: board size board configuration number of captured stones of either color move history komi time settings
Required Commands Section 6.3 interface.c Administraive protocol_version name version known_command list_commands Quit Setup boardsize clear_board Komi Core Play play genmove
GoGui gogui program command size n computer-black|white|both|none gogui-client hostname port gogui-twogtp -black command -white command (-size n) @echo off set BLACK=E:\go\Desktop\exe\brown.exe set WHITE=E:\go\Desktop\exe\ZGO.exe set TWOGTP=""E:\go\GoGui\gogui-twogtp"" -black ""%BLACK%"" -white ""%WHITE%"" -size 13 "E:\go\GoGui\gogui" -program "%TWOGTP%" -size 13 -computer-both -verbose