online-go / gtp2ogs

GTP Wrapper to allow bots to interface with the Online-Go.com Server
MIT License
88 stars 29 forks source link

Proper GTP format #68

Closed TokumotoK closed 1 year ago

TokumotoK commented 6 years ago

This is an enhancement request.

There are bots that only understand "play B q16" format, and not "play black q16". While not understanding "play black q16" is proper GTP, I see this as a major barrier to holding a bot tourney on OGS.

I have accommodated such bots by a dirty hack of creating a gtp2ogs.js version that understands only "play B q16" format, but obviously the proper approach is to check (by gtp list_commands and known_command?) and determine the preferred format of the bot, and send the preferred format henceforth.

To me, this is a much bigger issue than proper handling of handi-stones for forked games.

roy7 commented 6 years ago

Nothing in list_commands can tell us about this though, right? The command is "play".

TokumotoK commented 6 years ago

ah, right... wonder how good old GoGUI does the checking (https://sourceforge.net/projects/gogui/). May be one of the files in https://sourceforge.net/p/gogui/code/ci/master/tree/src/net/sf/gogui/gtp/ could tell you ?

roy7 commented 6 years ago

https://sourceforge.net/p/gogui/code/ci/master/tree/src/net/sf/gogui/gtp/GtpClientBase.java

For old bots that didn't understand color commands, it just does "play" then the move. Otherwise, it uses "black" and "white". This is in getCommandPlay line 85.

roy7 commented 6 years ago

We could change gtp2ogs to not use full color name, but I worry some existing working bots might break if they don't support single letter colors. Of course, to support GTP spec you should accept both.

TokumotoK commented 6 years ago

Oh, the checking is done with 'protocol_version' it seems. In that GtpClientBase.java, line 88 says: if (m_protocolVersion == 1) If the bot uses GTP Protocol Version 1, then "play black q16" format is used, otherwise "play q16" is used (line 98 - 102).

Didn't realize GoGUI's normal command is not "play B q16", but as I have never experienced ANY bot having problems with GoGUI's GTP implementation, may be this protocol version check is the proper method.

roy7 commented 6 years ago

So I think the real issue isn't 'b' vs 'black' but old bots that don't support GTP Protocol Version 1. Do any bots we care about these days actually not support V1 though?

TokumotoK commented 6 years ago

Not sure if it's a matter of not supporting V1, but AQ, for example, does not work with "play black q16". AQ is a relatively new project started about a year ago.

roy7 commented 6 years ago

How odd. You could post an issue or suvmit a PR to fix it for them. :) I will later this week if you don't want to.

TokumotoK commented 6 years ago

Haha. Come to think AQ latest version might already have implemented it. I started running AQ many versions ago, and have used the dirty hack "play B q16" version gtp2ogs ever since. As you are well aware I am not a coder, and I suck at git :P

roy7 commented 6 years ago

You have done a lot of neat things for someone who isn't a coder. :)

TokumotoK commented 6 years ago

If I were a coder, I'd work on GTP v.3, adding win rate, move candidates and hardware-related (number of threads, cpu and gpu) info. With them, we could hold bot tournaments like "up to 8 core 1 gpu bots only" and "bots are allowed to inquire opponent winrate". Moreover, teaching bots could tell the students what moves were particularly bad (big rise in bot winrate) showing alternatives.

(GTP version 2 has been de facto standard for a long time, and it's not odd at all that some new bots don't accept version 1 commands.)

roy7 commented 6 years ago

I just installed AQ to test it and "play w a1" and "play black a2" and "play WhItE a3" all worked properly.

TokumotoK commented 6 years ago

According to https://sourceforge.net/p/gogui/code/ci/master/tree/src/net/sf/gogui/gtp/GtpClientBase.java#l30 from line 30 to 100

GTPv.1 commands - boardsize - genmove_black - black q16 GTPv.2 commands - clearboard - genmove b - play q16

wonderingabout commented 5 years ago

i am looking very forward to a bot tournament on OGS

recently, we noticed showboard command breaks PhoenixGo so @roy7 removed it

if there is anything that can be improved i would highly appreciate it

github-actions[bot] commented 1 year ago

This issue has been marked stale and will be closed soon without further activity. To keep the issue open, please respond to the comment to keep the discussion going.

github-actions[bot] commented 1 year ago

This issue has been automatically closed due to inactivity. Please feel free to re-open it if the issue persists.