GithubHelp home page GithubHelp logo

gtp2ogs's People

Contributors

anoek avatar dependabot[bot] avatar dorus avatar lemonsqueeze avatar pablolion avatar raylu avatar roy7 avatar sanderland avatar thouis avatar windo avatar wonderingabout avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gtp2ogs's Issues

Simultaneous games question

Hi, i'm trying hook up Pachi to gtp2ogs, see how it does on ogs.
So far it's working fine for single games, but looks like i'm having an issue with simultaneous games.

How is it supposed to work at the moment ? gtp2ogs spawns one engine instance per simultaneous game ?
(trying live games atm, running with --persist)

Looks like this is what's happening, my engine script gets spawned again when the 2nd game starts and it's not happy about it. Maybe i need PR #44 to use a single instance instead ? But this only works for correspondence games i guess...

Otherwise i can fix my side to handle multiple instances, but i need a way to set max number of simultaneous games (if it spawns 30 instances it's going to be an issue ...)

Using move alone to trigger genmove

@anoek I was thinking when I first noticed the lag between move and active_game that maybe I should just start the bot thinking. I came up with a work around plan, but is it safe to just ignore active_game for games already connected and simply do everything based on move? I was worried what if move comes in, active_game is 10 seconds later, and I submit a move before the active_game arrives. Will the server reject it if it thinks it is still on the prior move? Or can I assume once I get opponent's move event it is safe for me to move immediately?

This would eliminate move/active_game race conditions. I'd just move any time I receive opponent move, and if I get an unexpected gamedata event I can either try to salvage (send any missing move to the bot) or just restart the bot in that case.

Config file containing all arguments instead of command line

so

as @windo suggested in #119 (comment) , i thought it would be a very nice idea to use a config file instead of a bunch of randomly lineared argv

what motivated me to do that is to add --minmaintime --minperiodtime differently for blitz,live, corr games etc...
for example maxmaintimelive 600 maxmaintimecorr 86400
so its about time we do this config file i think

easily readable, easily exportable, easily expandable to add new features to config, etc..

i dont have any knowledge on the topic, but i'm willing to try and learn,

this is the documentation @Dorus sent me on discord :

will take some time for me to do it, maybe 1 or 2 weeks to release a pre-PR, but i think it would definitely be nice if doable before next master release, see #119

@roy7

"Challenge does not exist"

When I am logged in via browser as Bifron while Bifron is online, and if Bifron rejects a challenge (via auth() which results in "Challenge does not exist"), Bifron starts receiving a Challenge Notification once every 3 to 10 seconds on the same non-existing challenge until I manually reject the challenge on the browser.

As I felt this is a server-side issue, I discussed with anoek, who suggested to log it here so that roy7 might come up with a solution or have some idea on the issue. Content of the notification includes 'read' flag of '0', 'read_timestamp' of '0'

Uncaught error event

I'm not sure where to try catching this so we can reconnect cleanly. My log file showed:

gtp2ogs.js:412                 [9553 8295806] 3:48:20 >>> genmove black
gtp2ogs.js:1003                [Game 8295806] 3:48:20 clock: {"game_id":8295806,"current_player":419331,"black_player_id":419331,"white_player_id":429266,"title":"Friendly Match","last_move":1491464900063,"expiration":1491472280063,"black_time":{"thinking_time":7200,"periods":3,"period_time":60},"white_time":{"thinking_time":7200,"periods":3,"period_time":60},"start_mode":true,"now":1491464900235}
events.js:163
throw er; // Unhandled 'error' event
^

Error: read ECONNRESET
at exports._errnoException (util.js:1033:11)
at Pipe.onread (net.js:584:26)

Refuse PASS moves as part of handicap

This is more of an issue with my bot currently when it is confused by being allowed make a bunch of moves at the beginning of the game where it gets so confident in a win that it just passes. A player attempted to give the bot 18 handicap stones in a 9x9 game :)

I think the PASS also either confuses the server or gtp2ogs because after the first pass, gtp2ogs just hangs and does nothing with the game any more (until the gtp2ogs is restarted).

I think the correct solution here would be to reject the PASS, possibly resign/cancel the game and log something helpful about passes not being allowed as handicaps on the console.

Manage many bots with just one gtp2ogs command !!

so

while i was answering here https://github.com/online-go/gtp2ogs/pulls/101
i just got a very important idea of adding support to run several bots with just on gtp2ogs command

my purpose for doing this is for example if we replay an AI tournament, or even just for live games, i want my GPU to play 1 move at a time, yet spread the moves evely between bots

for example

bot 1

game a
game b
game c
bot 2
game z
game y
i want gtp2ogs to handle my gpu power if "one game at a time is specified"

for example

play first for bot 1 game a
then play for bot 2, game z
then play for bot 1, game b
etc...

@roy7 @Dorus @windo @lemonsqueeze

Chinese handicap support broke japanese handicap pre-existing games

Had a timeout, Leela's evenodd whose turn it is test was flipped so she never moved on an old Japanese handicap game that resumed after the switch to Chinese.

Need to add checks to see which rules we're using so we can apply handicap correctly. Will try to fix that myself today.

State not available for clock event, --nopauseranked failing

Someone was trying this command out which I don't use myself, and apparently state isn't defined in the clock handling code so it was giving reference errors each time. Gamedata comes in before the clock does per the game log.


May 10 01:27:13   gtp2ogs.js:1821                #  Connected
May 10 01:27:13   gtp2ogs.js:1821                #  Bot is user id: 535375
May 10 01:27:13   gtp2ogs.js:1821                #  active_game: {"id":12805087,"phase":"play","name":"Friendly Match","player_to_move":535375,"width":19,"height":19,"move_number":2,"paused":0,"private":false,"black":{"username":"HonteMaster","id":535375,"rank":0,"professional":false,"accepted":false,"ratings":{"overall":{"rating":1500,"deviation":350,"volatility":0.06}}},"white":{"username":"Ootakamoku","id":922,"rank":30,"professional":false,"accepted":false,"ratings":{"overall":{"deviation":88.0104751992121,"rating":2476.030215438667,"volatility":0.059959680307885135,"games_played":42}}},"time_per_move":10}
May 10 01:27:13   gtp2ogs.js:1027                [Game 12805087]            Connecting to game.
May 10 01:27:13   gtp2ogs.js:1027                [Game 12805087]  Move 2    gamedata       B Ootakamoku  [19x19]    
May 10 01:27:13   gtp2ogs.js:1027                [Game 12805087]  Move 2    makeMove 2 is 2 != 2 ?
May 10 01:27:13   gtp2ogs.js:352                 [24071] Starting  ./trollbot
May 10 01:27:13   gtp2ogs.js:1027                [Game 12805087]  Move 2    Starting new bot process [24071]
May 10 01:27:13   gtp2ogs.js:1027                [Game 12805087]  Move 2    State loading for new bot
May 10 01:27:13   gtp2ogs.js:352                 [24071] >>> boardsize 19
May 10 01:27:13   gtp2ogs.js:352                 [24071] >>> clear_board
May 10 01:27:13   gtp2ogs.js:352                 [24071] >>> komi 7.5
May 10 01:27:13   gtp2ogs.js:352                 [24071] >>> play black r17
May 10 01:27:13   gtp2ogs.js:352                 [24071] >>> play white d3
May 10 01:27:13   gtp2ogs.js:352                 [24071] >>> showboard
May 10 01:27:13   gtp2ogs.js:352                 [24071] Generating move for game 12805087
May 10 01:27:13   gtp2ogs.js:1027                [Game 12805087]  Move 2    genmove b
May 10 01:27:13   gtp2ogs.js:352                 [24071] >>> genmove black
May 10 01:27:13   gtp2ogs.js:1027                [Game 12805087]  Move 2    clock: {"game_id":12805087,"current_player":535375,"black_player_id":535375,"white_player_id":922,"title":"Friendly Match","last_move":1525904825523,"expiration":1525904875523,"black_time":{"thinking_time":0,"periods":5,"period_time":10},"white_time":{"thinking_time":0,"periods":5,"period_time":10},"now":1525904833506}
May 10 01:27:13 trace gtp2ogs.js:266                 ERROR: Uncaught exception
May 10 01:27:13 !!!!! gtp2ogs.js:267                 ERROR: ReferenceError: state is not defined
    at Socket.<anonymous> (/home/ootakamoku/eclipse-workspace/AnalyzeGameViaGTP/gtp2ogs/gtp2ogs.js:774:57)
    at Socket.Emitter.emit (/home/ootakamoku/eclipse-workspace/AnalyzeGameViaGTP/gtp2ogs/node_modules/component-emitter/index.js:133:20)
    at Socket.onevent (/home/ootakamoku/eclipse-workspace/AnalyzeGameViaGTP/gtp2ogs/node_modules/socket.io-client/lib/socket.js:275:10)
    at Socket.onpacket (/home/ootakamoku/eclipse-workspace/AnalyzeGameViaGTP/gtp2ogs/node_modules/socket.io-client/lib/socket.js:233:12)
    at Manager.<anonymous> (/home/ootakamoku/eclipse-workspace/AnalyzeGameViaGTP/gtp2ogs/node_modules/component-bind/index.js:21:15)
    at Manager.Emitter.emit (/home/ootakamoku/eclipse-workspace/AnalyzeGameViaGTP/gtp2ogs/node_modules/component-emitter/index.js:133:20)
    at Manager.ondecoded (/home/ootakamoku/eclipse-workspace/AnalyzeGameViaGTP/gtp2ogs/node_modules/socket.io-client/lib/manager.js:345:8)
    at Decoder.<anonymous> (/home/ootakamoku/eclipse-workspace/AnalyzeGameViaGTP/gtp2ogs/node_modules/component-bind/index.js:21:15)
    at Decoder.Emitter.emit (/home/ootakamoku/eclipse-workspace/AnalyzeGameViaGTP/gtp2ogs/node_modules/component-emitter/index.js:133:20)
    at Decoder.add (/home/ootakamoku/eclipse-workspace/AnalyzeGameViaGTP/gtp2ogs/node_modules/socket.io-parser/index.js:251:12)

Note on other branch

Hi there, I was just looking for a gtp2ogs option today and found this and then saw you were actively working on it today. While you are in there you might want to check out changes from this branch:

https://github.com/tk44/gtp2ogs

in case anything in there is of use to you. Someone in the OGS forum had mentioned they had to use that branch to get it working in the past.

Cleanly support a wide range of time settings.

Admin allows time systems: none, absolute, simple, fisher, canadian and/or byo-yomi.
For none, no future checks are required.
For absoluate, only min and max main time needs to be checked.
For simple, only min and max period time needs to be checked.
For fisher, you need to check initial time against min and max main time. You need to check added time vs min and max period time.
For canadian, you need to min and max main time. You need to check time per x stones against by taking (period time divided by x) and compare against min and max period time. You need to check x stones also against min/max nr of periods.
For byo-yomi you need to check min and max main time, min and max period time, and min and max periods.

So bot admins only need to set allowed time systems, min and max main time, min and max period time, min and max periods. A total of 7 settings to support everything.

Default host

Should it be ggs.online-go.com instead of online-go.com? I find the first gives an instant response, whereas the second times out.

Default ggsport should be 443 as well. I know it is in the --devel branch but if you aren't ready to officially release the --devel changes maybe you should just pop in the host/port changes so new users don't get tripped up on that?

gtp2ogs restart with many in-flight games can cause instability

This one might again be more about my suboptimal bot setup, but with ~10 concurrent games, restarting gtp2ogs was very problematic. My bot takes several seconds to initialize the neural network on startup and with many games, it was taking longer. I don't know what exactly was going on, but I think it was taking long enought that either the web sockets were timing out or the bot pipes were timing out - in any case I was having a hard time getting the bot to connect to all the games again.

I don't know exactly what the solution should be. I think gtp2ogs could probably rate limit the starting of new bots or maybe just the socket timeouts can be increased.

Minimum main time not supported in Byoyomi

Bifron logged:
"# Minimum main time not supported in time control: byoyomi"

I commented out the following 3 lines:
if (
["simple","none"].indexOf(notification.time_control.time
_control) < 0 ) {
with:
if ((notification.time_control.time_control == "simple")
|| (notification.time_control.time_control == "none")) {
and it seems to work.
Probably the same applies to Maximum main time, too.

Rethinking simple time support

So,

While working on the amazing UHMAEAT PR here #115, i noticed simple time support is very confusing !!

Because basically :

  • simple time has a main time with t.main_time
  • but !! simple time also has a period time with t.per_move ??

So it has both a maintime and a periodtime, but only one of these ?
how does a botadmin take that into account when using argv ?

also is it safe to use on the GTP side, do bots really understand this time setting well ?

the UHMAEAT can easily re implement simple time if needed, once this issue is cleared

Reconnecting starts another bot, even if one is already mid-genmove

It seemed a few times in my testing tonight, gtp2ogs would get disconnected from the server. It'd then reconnect, load a fresh bot, load state info it, and genmove. But the prior bot before the disconnect, if it was in the middle of a genmove, is still running along.

Is it possible to still just communicate with original already running bot to provide the move when genmove completes after a reconnect, without spawning a new bot? If spawning a new bot is required, then we probably want to kill the process if a disconnect event happens. Seems like a waste of cpu to do that though and make the bot start over.

Dependencies are apparently broken for npm installs

Performing a npm install -g gtp2ogs should be all that is necessary, however something is wrong with dependency installation and thus the current work around is to npm install optimistsocket.io-client after they install gtp2ogs. This should not be necessary.

Make it optional for bots to appear in Vs Computer drop down?

As more people ask about setting up bots, just to play around with briefly I think, it might be nice for them not to appear in the Vs Computer list as a toggle the operator can set? Maybe they just want to run a program on OGS but not have it accept challenges from the public. My concern is if someone is testing or just wants to have a bot play a specific game, when they stop the bot any other random public challenges will all time out and provide a bad experience to the unsuspecting human opponents?

Support `place_free_handicap`

The GTP spec calls for place_free_handicap to be called when handicap stones are placed.

IDK if other engines support it, but for my bot it would be helpful because for one then it would not have to guess how much handicap it is given (it technically takes handicap into account when playing) and also it would choose differently if it could play without white having a chance to play any stones.

I would probably be sending a PR for this if it sounds like one would be accepted.

If other engines do not support this, then I think this relies on also implementing detection of supported commands so gtp2ogs would know which engines to send the command to. Although a command line option would work too.

No tests for gtp2ogs

It can be tricky to validate that changes don't cause regressions without any test coverage. At the very least, I think there should be some "smoke tests" for the integration of all the parts.

I'd like to split the gtp2ogs.js file into a "main file" and library file(s) (say bot.js, game.js and connection.js) so that the code could be loaded into test cases without triggering all of it to run end-to-end immediately. Then I'd like to add some basic test coverage that all the parts fit together - a basic integration test that mocks the GTP program and OGS server to behave well and confirm that gtp2ogs behaves relaying between the two.

I haven't done a whole lot of node.js development, is mocha an acceptable module to use for testing? And simple-mock for mocking the GTP process and OGS server?

Does splitting up the main file into a few separately loadable files sound OK? Or should I try to keep as much of it together as possible and try to separate a minimal "entry point" file?

Manual handicap placement not recognized by gtp2ogs

Issue for myself to work on I think, under Chinese rules (or at least when there's 7 handicap) opponent manually places the handicap stones. This confuses the bot, thinking it is the bot's turn after a play is made since there are move events coming in.

Need to check not just the evenodd toggle, but also if moves.length is > # of handicap stones, so bot won't start moving until all handicap stones are placed.

Chinese handicap : "waiting for you to play all your handicap stones" message

@roy7 @ anoek
i noticed several players dont realize they have to play all the handicap stones when the game starts

after they play one stone, they wait a long time, and sometimes they even leave the game

it would be good to add a bot message during the game telling the player that more stones need to be added

for n handicap stones, at every x number of handicap stone played

"you put x handicap stones, please put n-x more handicap stones"

example for a 6 handicap stones game:

"you put 1 handicap stones, please put 5 more handicap stones"

something based on if and else :)

my most recent example, this player https://online-go.com/game/15885917 waited like 3 minutes before playing his 2nd handicap stone

How can I tell if my bot has connected to OGS?

I just setup a bot account today and wanted to test Leela. I believe I have everything setup correctly but after starting gtp2ogs it just hangs here:

dflake@dflake-laptop:~/Desktop/Leela$ /usr/bin/nodejs /usr/local/bin/gtp2ogs --botid flakebot --apikey <key_withheld> -- /home/dflake/Desktop/Leela/leela_090_linux_x64 --gtp --logfile /home/dflake/Desktop/Leela/leela.log
(node) sys is deprecated. Use util instead.
[ggs.online-go.com80] Connecting..https://ggs.online-go.com:80

I never see the bot actually connect and it doesn't accept any game challenges. Any help debugging would be appreciated. Thanks,

Devin

Is phase==play pass still needed?

I saw this happen in a game, I assume because of a server pause situation or a player pausing and un-pausing. It printed the 'lazy' message to the log file.

gtp2ogs at the moment doesn't look at pause/play states when deciding if it should move. If a new connection/gamedata is our turn, we make a move. If a move event comes in that was the opponent's move, we make a move. The bots play fine during a paused game.

But if a human opponent moves, starting bot's makeMove/genmove process, and then unpauses, the phase==play event would trigger the bot to immediately pass. This would cause internal bot state with --persist to be wrong (it generated a move the server didn't get).

I'm just not certain on all situations a phase==play event might be sent from the server and if there's some special situation(s) that actually do need handled? Or can we just comment that out for now and not pass when games are un-paused?

It also seems if game scoring doesn't go through, and we move back to phase play from phase stone removal, we'd immediately pass again.

This is the section around line 661.

Unknown command errors can interfere with callback buffer processing

Had a situation where someone used --kgstime with RayN, which doesn't know kgs-time_settings command. This caused an "? Unknown command" response from the bot. After this, other valid commands with proper response (such as genmove for first move of the game) did not get processed correctly.

I'm assuming the unknown command response didn't get consumed off the stdin buffer properly, since issuing the commands that resulted in error weren't expecting any response. Need to be sure any unknown command errors are either cleared and then the next step in buffer read by a later command, or some sort of clean error message is reported to the log.

Startupbuffer better replacement

This was bigger than I wanted to try and tackle so I've ignored it, but the --startupbuffer I added as hack to handle the fact the time_left command is sent to the bot while it's starting up on that first move, but the bot won't read the command until the initial startup has completed. This means by the time the bot reads the time_left command, some time has been spent and the info is outdated.

A way around this might be to detect when the prior commands like 'komi' have returned the empty '=' response (so we know bot has initialized and is awake) and then send time_left using actual current time left. In the Chess world the engines seem to have an is_ready command they send and the clock doesn't start until the bot says it is ready.

LZ might eventually create multiple startup threads to process GTP commands even while initializing but a more flexible solution for all bots would be best for gtp2ogs to try and support. Perhaps just sending a mandatory GTP required command (list_commands?) at bot startup and not send the time_left/etc until we have that response is a solution.

Posting this as a reminder one day it maybe needs improved.

Cannot read property 'game_id' of null

I like the --greeting and --farewell, but Kugutsu, Nicaso and Bifron all disconnected from OGS after they started using the Whitespace version as follows:

/usr/src/gtp2ogs-devel/gtp2ogs.js:876
if (argv.farewell && this.state.game_id != null) {
^

TypeError: Cannot read property 'game_id' of null
at Game.disconnect (/usr/src/gtp2ogs-devel/gtp2ogs.js:876:40)
at Connection.disconnectFromGame (/usr/src/gtp2ogs-devel/gtp2ogs.js:1116:43)

All 3 bots had exactly the same Error.

I am replacing the line 876:

  •    if (argv.farewell && this.state.game_id != null) {
    

with

  •   if (argv.farewell && this.state.game_id) {
    

and will observe how it runs.

Crash report

Care of @TK44

gtp2ogs.js:402                 [Game 1104] Playing p16 { x: 14, y: 3, text: 'p16', resign: false, pass: false }
  gtp2ogs.js:148                 [6324] stderr:
88513 visits, 12320 nodes, 6986 vps
 
 
  gtp2ogs.js:402                 [Game 1104] Disconnecting
  gtp2ogs.js:835                 #  Connecting to game 1104
!!!!! gtp2ogs.js:319                 [TypeError: Cannot read property 'moves' of null]
C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\gtp2ogs.js:277
            if (this.state.phase == 'play') {
                          ^
 
TypeError: Cannot read property 'phase' of null
    at Game.check_for_move (C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\gtp2ogs.js:277:27)
    at Socket.<anonymous> (C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\gtp2ogs.js:324:13)
    at Socket.Emitter.emit (C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\node_modules\socket.io-client\node_modules\component-emitter\index.js:131:20)
    at Socket.onevent (C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\node_modules\socket.io-client\lib\socket.js:270:10)
    at Socket.onpacket (C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\node_modules\socket.io-client\lib\socket.js:228:12)
    at Manager.<anonymous> (C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\node_modules\socket.io-client\node_modules\component-bind\index.js:21:15)
    at Manager.Emitter.emit (C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\node_modules\socket.io-client\node_modules\component-emitter\index.js:131:20)
    at Manager.ondecoded (C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\node_modules\socket.io-client\lib\manager.js:332:8)
    at Decoder.<anonymous> (C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\node_modules\socket.io-client\node_modules\component-bind\index.js:21:15)
    at Decoder.Emitter.emit (C:\cygwin64\usr\src\gtp2ogs-dev\gtp2ogs-devel\node_modules\socket.io-client\node_modules\socket.io-parser\node_modules\component-emitter\index.js:134:20)

Add --pausemaxtime

Add an option to allow pausing but with a max time limit. Handle it like --nopause but SetTimeout() instead of resuming immediately. If game resumes, clear the timeout.

Proper GTP format

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.

Komi commands

Eventually need to add an option to require a specific komi, since for instance Leela Zero only understands 7.5 and will only play thinking it's 7.5 no matter what it is really set to. It's be nice to set bot to reject games with other komis. Just no --komi command yet. :)

place_free_handicap

Follow up on #65 for the case where bot is playing black with handicap:

So we need to send place_free_handicap instead of genmove at the beginning. It returns all the stones at once so probably have to store them somewhere and return them one by one to server when asked. I'm not super familiar with gtp2ogs code so first idea was to re-engineer makeMove() to do it behind the scene and keep current interface, this way the rest of the code doesn't have to change.

Attempting to move twice in a row

My logs aren't the best for this... but basically K6 was a valid move. However the bot is asked to make another move before the opponent had gone. It came up with N7, which turned out to the move the opponent already made. Since the move isn't valid the server ignores it, but gtp2ogs just sits there waiting. I log most events, but nothing seemed to arrive before the makeMove 46 happened. Is it possible the SetInterval "when bored" code could cause a spurious turn to be taken when it isn't the bot's move?

gtp2ogs.js:209 [14972] <<< = K6
gtp2ogs.js:688 [Game 1911] Playing k6 { x: 9, y: 13, text: 'k6', resign: false, pass: false }
gtp2ogs.js:1174 # clearTimeout 1911
gtp2ogs.js:1174 # setTimeout 1911
gtp2ogs.js:688 [Game 1911] clock
gtp2ogs.js:209 [14972] >>> kgs-time_settings byoyomi 600 29 5
gtp2ogs.js:209 [14972] >>> time_left black 444 0
gtp2ogs.js:209 [14972] >>> time_left white 207 0
gtp2ogs.js:688 [Game 1911] clock
gtp2ogs.js:209 [14972] >>> kgs-time_settings byoyomi 600 29 5
gtp2ogs.js:209 [14972] >>> time_left black 435 0
gtp2ogs.js:209 [14972] >>> time_left white 207 0
gtp2ogs.js:1174 # Connected to game 1911 already
gtp2ogs.js:688 [Game 1911] makeMove 46
gtp2ogs.js:209 [14972] Generating move for game 1911
gtp2ogs.js:209 [14972] >>> genmove white
gtp2ogs.js:1174 # clearTimeout 1911
gtp2ogs.js:1174 # setTimeout 1911
gtp2ogs.js:1174 # clearTimeout 1911
gtp2ogs.js:1174 # setTimeout 1911
gtp2ogs.js:209 [14972] <<< = N7
gtp2ogs.js:688 [Game 1911] Playing n7 { x: 12, y: 12, text: 'n7', resign: false, pass: false }
`

The actual game played was

https://beta.online-go.com/game/1911

Server Error ?

Got this today running f6f3017:

Jun 04 05:20:14 !!!!! #  500 - <h1>Server Error (500)</h1>
Jun 04 05:20:14 !!!!! Error
    at conn_log (/home/go/src/gtp2ogs/gtp2ogs.js:1820:23)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Don't know what this is. It continued running afterwards but in a dead state, not sure if it was still visible to players.

Filter games on privacy setting

It'd be nice to have a toggle for the bot to only play public games and reject all private games. (Or vica verse as the operator prefers.) Posting this as a future reminder to myself but maybe someone else would like to add the feature and submit a PR. :)

Allow any komi

My gtp2ogs rejected a challenge with:

Jan 01 23:56:27   #  komi value 5.5 is not an allowed komi, allowed komi are: null, rejecting challenge

How do I specify that all komi are accepted?

Beta server removed time_control.speed?

I noticed on beta server gtp2ogs can't seem to reject games successfully, and that time_control.speed was removed? I use that to filter on blitz/live/corr game speeds on one of the command line options, and currently my own bot doesn't play corr.

Is 'speed' going away?

404 error Challenge does not exist

So in the last days i noticed the "challenge" does not exist error happens a lot !!

see my recent messages and screenshots here :
#52

this week, i got this error 4 times, thats a lot lol (didnt screenshot them all)

below is a summary of these errors

day 1 (18 january)

challenge does not exist loop
challenge loop2

for this first time the challenge looped (hundreds of errors for hours)
scrolling ogs notifications, i noticed one challenge was not deleted automatically by the bot (main time too short)

then the other times, i checked but there was no challenge to be deleted on the notifications (but still triggered the "challenge does not exist error" once)

day 2 (19 january)

challenge error3

day 3 (yesterday) :

challenge error

day 4 (27 january)

challenge error4

@roy7 @TokumotoK @Dorus @windo @lemonsqueeze

any idea why and how to fix ?

this can be very confusing for new gtp2ogs users

Options for max and min rankedhandicap and 'auto' handicaps

Since automatic handicap provides handicap=-1 in the notification, we either need the API add info about our own handicap to the notification (so we can calculate the the expected real handicap at the time of notification) or fetch our user details each time a new challenge arrives.

Currently I just reject auto handicap in my production copy since it is a way away round the maxrankedhandicap setting.

Issues with slow startup of bot

I am new to OGS and gtp2ogs and tried to set up a bot for regular games. I use a command similar to the following for this purpose:

pushd C:\path\nodejs && node.exe C:\path\nodejs\node_modules\gtp2ogs\gtp2ogs.js [...] \
        --startupbuffer 20 --persist -- bot bin args

This works when the game has sufficient time. But when playing blitz, the bot takes too long to start and times out before making the first move.

Apparently the bot process is only started once the game begun. Is there a way to start it immediately, before connecting to OGS? Then it could react in an instant without booting up.

gtp2ogs may hang when opponent resumes playing from scoring

IDK know the exact circumstances, but I observed in one of my bot games that the opponent managed to refuse the autoscore results and resumed playing. However gtp2ogs did not call the bot to generate any more moves and just waited there. I manually restarted gtp2ogs and the play resumed.

This was with a few weeks old version. I do not currently have logging enabled so I can't figure out exactly what gtp2ogs was thinking when this happened.

Bot confused about it's color in certain situations

This is so rare but does sometimes happen, I have no idea how to predict it.

gtp2ogs.js:493 [30389 9774756] 8:52:09 <<< = Q14
gtp2ogs.js:1139 [Game 9774756] 8:52:09 Playing q14 { x: 15, y: 5, text: 'q14', resign: false, pass: false }
gtp2ogs.js:1139 [Game 9774756] 8:52:09 clock: {"game_id":9774756,"current_player":442563,"black_player_id":419331,"white_player_id":442563,"title":"csprou sky","last_move":1504529529883,"expiration":1506343929883,"now":1504529529884}
gtp2ogs.js:1139 [Game 9774756] 8:52:09 game/9774756/move: { game_id: 9774756, move_number: 22, move: [ 15, 5, 27504829 ] }
gtp2ogs.js:493 [30389 9774756] 8:52:09 Calling sendMove with q14
gtp2ogs.js:493 [30389 9774756] 8:52:09 >>> play white q14
gtp2ogs.js:1139 [Game 9774756] 8:52:09 makeMove 22 is 22 != 22 ?
gtp2ogs.js:493 [30389 9774756] 8:52:09 Generating move for game 9774756
gtp2ogs.js:493 [30389 9774756] 8:52:09 >>> genmove black

The logs show after reconnecting when I started gtp2ogs up fresh that it 'ignored our own move 21' except that was an opponent's move. Genmove ran and came up with move Q14. But when the move event comes back, gtp2ogs tries to play it to the board as a white move and asked for another genmove when it isn't the bot's turn.

Only thing odd about this game, and maybe the hint for debugging, is it was a pre-made board setup with 4 moves already played. (2 by each player). Perhaps the logic on "what is my color" is failing in certain forked game setups.

I'll be poking at this myself but wanted to record the issue.

Main things to prioritirize before next master release

So 🔢

history tells us :

  • release 5.1 : march 2017
  • release 5.3 : march 2018
  • release x.x : xxx xxxx

also a lot of new features, improvements, and fixes, have been released since that time, too much to list them all here

but maybe some have words of important things we may want to look again at before making a new major release

mostly directed to code contributors so far, but more generally to everyone
@anoek @roy7 @Dorus @windo @lemonsqueeze @TokumotoK

as for me i want to look again at :

  • autohandicap issue in #28 : using --noautohandicap removes the issue but doesnt solve it, we want to make automatic handicap dynamically detect min and max handicap, and adjust to rank difference
  • simple time support in #116 : does it use main time t.main_time or period time t.per_move, and how to support it again on gtp2ogs ?
  • challenge 404 error #100 and #52 : does not crash the bot so far so been given a low priority, but still occuring every while, sometimes it even loops when gtp2ogs fails to reject a game for some reason, we may want to look again at log behaviour as well as reject behaviour
  • remove most warnings and replace them with defaults
  • rename --maxtotalgames and --maxactivegames to the clearer connected games
  • @roy7 maybe you want to have a look again at the --persist behaviour for corr games ? in #59
  • using a config file instead of argv command line, is easily exportable and much more flexible to add new options, but also easier to read and edit, in #125

will be updated as we add or point more things

feel free to use this issue as a more general discussion of what we want to do more generally before the release and after

Auto scoring fail can lead to abuse

Have had this happen a number of times vs RoyalLeela, if the auto score accept fails, the human player changes the board to give themself a win. The bot doesn't argue the score, and so it is accepted via timeout.

An idea since not all bots can provide lists of dead stones to try and handle scoring directly is to accept the score the moment it first appears, but reject score any time human manually makes a change. So if you want bot to accept a score after both sides pass, you can't manually change anything on the board. That should at least enforce the auto score initial results?

If the server auto score works, then that's that, this would be a failsafe on the gtp2ogs side in case server doesn't enforce auto scoring.

This is the sort of thing I'm trying to avoid:

https://online-go.com/game/8514311
https://online-go.com/game/8530265
https://online-go.com/game/8518362

etc

Don't connect to finished games

See: #55 (comment)

Since we connect to every active_game, even finished ones, we end up connecting and disconnect()'ing over and over until server stops telling us about that game, which makes the farewell code send a farewell every time we disconnect().

If we check for game status when active_game comes in, we could simply not connect to a finished game in the first place. Then the disconnect() later wouldn't be needed since it wouldn't be in the connected_games list.

Not using set_free_handicap ?

One thing i'm confused about: human plays black with handicap, why does gtp2ogs use play commands to send handicap stones to the engine ? Shouldn't it be using set_free_handicap instead ?

I see it's there in the code, but only on loadstate(), so it's practically never used.

I had to put some workarounds in Pachi because of this, otherwise handicap wouldn't get detected correctly. Not sure how other engines cope with this...

Illegal move

Amazingly enough i just witnessed a game live where gtp2ogs and the engine went completely out of sync as far as board state is concerned, and ended up in illegal move (beginning of the game is fun to watch, makes no sense !). At this point it got stalled and looks like it would have timed out if i hadn't restarted gtp2ogs. This doesn't happen often (looks like i have 6 over 20 day period). I guess i must be attracting bugs at the moment =)

I have both sides' logs so should be able to work out what happened.

@roy7 Have you come across this with Leela as well ? If you keep logs i'd be curious how many 'illegal move' you get. Also that could be a cause for mysterious losses by timeout i guess...

Fischer time controls need refactor

The way I handle Fischer is by converting it into a fake Canadian byoyomi that I pass on to the engine. I noticed the other day though RoyalZeroSlow was thinking way too long. From the log file it was using all of the time for each move as a maximum, so only the playout limit was stopping it. I thought maybe it was a LZ error, I posted it here leela-zero/leela-zero#2105 but turns out how I'm handling it is wrong and LZ is behaving correctly.

Putting this issue as a reminder to myself, or perhaps someone else will give it a shot on better Fischer support.

Bot is called after passing

I'll try to debug this more myself, but I'm guessing the test for gamedata.phase == 'stone removal' is obsolete since bot games are auto scored on the server now? Debug log below shows after passing, the bot was fired back up for a genmove prior to (or for?) the stone removal phase.

  gtp2ogs.js:165                 [15660] <<< = pass
  gtp2ogs.js:594                 [Game 1633] Playing pass { x: -1, y: -1, text: 'pass', resign: false, pass: true }
  gtp2ogs.js:165                 [15660] Killing process
  gtp2ogs.js:1041                #  Connecting to game 1633
  gtp2ogs.js:165                 [12968] Starting  Leela081GTP.exe --gtp --noponder --logfile leela.log --lagbuffer 300
  gtp2ogs.js:165                 [12968] Generating move for game  1633
  gtp2ogs.js:165                 [12968] >>> boardsize 9
  gtp2ogs.js:165                 [12968] >>> clear_board
  gtp2ogs.js:165                 [12968] >>> komi 5.5
  gtp2ogs.js:165                 [12968] >>> kgs-time_settings canadian 300 6 7
  gtp2ogs.js:165                 [12968] >>> time_left black 298 0
  gtp2ogs.js:165                 [12968] >>> time_left white 290 0
  gtp2ogs.js:165                 [12968] >>> play black j1
  gtp2ogs.js:165                 [12968] >>> play white d5
  gtp2ogs.js:165                 [12968] >>> play black pass
  gtp2ogs.js:165                 [12968] >>> showboard
  gtp2ogs.js:165                 [12968] >>> genmove white
  gtp2ogs.js:594                 [Game 1633] clock
  gtp2ogs.js:594                 [Game 1633] clock
  gtp2ogs.js:594                 [Game 1633] clock
  gtp2ogs.js:594                 [Game 1633] phase  stone removal
  gtp2ogs.js:594                 [Game 1633] clock
  gtp2ogs.js:594                 [Game 1633] clock

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.