-About this package This package includes the C++ library that helps authors implementing GTP(Go Text Protocols) for their Go program, and the ruby scripts that can connect the programs, that support GTP, to NNGS. Because the scripts for communication with NNGS are written in ruby, these scripts may be able to run in many OS enviroments. When the archived file is extracted, the directory "gtp_go" is created. The files under gtp_go/gtp_sample directory are GTP library, and the ruby scripts under gtp_go directory are the scripts that connect the programs to NNGS. -About the GTP library and the sample program The files under gtp_go/gtp_sample directory are GTP library. You can implement GTP for your program by using this. The libraries handle the GTP protocol. Please implement the following method of engine class. # You can edit "sample.cc" to implement GTP easily. std::string engine::name() This is for GTP's "name" command. Please return the name of program. std::string engine::version() This is for GTP's "version" command. Please return the version. void engine::reset(int size, float komi) This is for GTP's "boardsize", "komi", "clear_board" commands. Please reset the board information to received board size and komi. This function is called whenever the "boardsize" or "komi" or "clear_board" is called. void engine::time_settings(int, int, int) This is for GTP's "time_setting" command. void engine::time_left(COLOR c, int t, int s) This is for GTP's "time_left" command. The rest time (seconds) of the game is in "t". void engine::genmove(int& i, int& j, COLOR color) This is for GTP's "genmove" command. Please generate the next move for color from current position and set the data of generated move to i and j. And please call "playmove" and update board position informations. void engine::playmove(int i, int j, COLOR color) This is for GTP's "playmove" command. The information of the move is in i, j, and color. bool engine::legal_move(int i, int j, COLOR color) This function is called to check up if the move is legal or not befor the playmove is called. void engine::undo() This is for GTP's "undo" command. Please undo the last move. COLOR engine::get_board(int i, int j) This is for GTP's "showboard" command. Please return the information of specified cordinate. void engine::compute_final_status() This is for GTP's "final_score" command. This is call after the game end. Please decide the final board state. COLOR engine::get_final_status(int i, int j) Please return the final board state of specified cordinate. -How to use the ruby scripts for communication with NNGS If you need, please edit the configuration file (config.rb). -------------------------------------------------------------------- $config = { 'NNGS' => { 'server'=>'localhost', #NNGS server name 'port'=>'9696', #NNGS port number 'user'=>'test1', #login user name 'pass'=>'' #login password(not need for guest users) }, 'GTP' => { # program name of GTP Go program 'command'=>'/usr/games/bin/gnugo --mode gtp --quiet' }, 'SIZE' => 5, # board size # 'SIZE' => 10, # 'SIZE' => 19, 'TIME' => 10 # time (minutes) } -------------------------------------------------------------------- You start the script from command line. ruby nngsCUI.rb ruby nngsCUI.rb user (NNGS user name) ruby nngsCUI.rb user server (NNGS user name, NNGS server) After the script starts up, the characters "input user:" are displayed. If you input the username of opponent player, the script requests the match as black player to this user. If you input simply "Enter", the characters "waiting match request." are displayed and waiting the match request from others. In this case, we become white player. When someone requests the match, the characters "match requested. accept(Y/n)" are desplayed. Please select y or n. If you input "n", the script returns to first opponent user input. When other, the script starts the Go program with GTP communication, and the game starts on NNGS. If there is no trouble, the script proceeds the game automatically, and after the game end, the script automatically log-out from NNGS. -About the input to Go Program Go program is input GTP program by the script. 1. Match configuration boardsize 5 komi 0 clear_board 2. Move information of opponent play BLACK C3 3. Information of time limit and the request of next move time_left WHITE 600 0 time_left BLACK 600 0 genmove WHITE 4. End quit Following is the order of input. boardsize komi clear_board while { playmove time_left BLACK time_left WHITE genmove } quit