Since early January new WatchBot (the bot) version is operating. Almost nothing changed from the user perspective, still I decided to make a note as some old bugs are gone, while some new bugs appeared.
I have rewritten from scratch the quick and dirty code responsible for dispatching the work between a few guest observers (initially added to reduce impact of frequent network problems which appeared in late 2011). In particular, double-whispers problem (which resulted from two guests observing the same game) should be gone for good, or at least is much much less likely.
At the same time, I introduced new bugs resulting in games being missed, or saved prematurely, or wrong games being picked. Today I pushed update which fixes various border cases, it's true effect remain to be seen.
Coordinating information from a few FICS connections is fairly fascinating programming task. Here is the sequence which led to one of recent "dropped game" cases:
- bot-1 observes game 274 Xxx-Yyy, gets successive moves and whispers, and records them,
- bot-2 (which has gin=1) gets info that game 274 has finished
- I note the game finish, save the game, and command bot-1 to unobserve it (it is necessary to unobserve finished games as some people have examine variable set and in such case the game remains open and observed by kibitzers)
- bot-1 issues "unobserve 274"
- bot-2 (thanks to gin) gets notification that another game 274 (say Zzz-Vvv) has started, bot-3 is picked to watch it
- bot-3 issues "observe 274"
- bot-3 gets reply to this command, with game details, the game is interesting so we keep observing it,
- bot-3 gets initial move or maybe a few of Zzz-Vvv, and records them,
- bot-1 gets … final move of game Xxx-Yyy (which I ignore as it does not match the current game)
- bot-1 gets info that game 274 just finished (it is about Xxx-Yyy but I mistakenly attribute it to currently lasting Zzz-Vvv), so I close the game, as only a few moves were made, I drop the game without saving it,
- bot-1 gets info that it stopped observing game 274
- bot-1 gets error "You are not observing game 274" to the command "unobserve 274" issued some time ago
- bot-3 gets further moves of Zzz-Vvv but I drop them because I do not have this game open.
To a degree, this is similar to well known (especially to mobile players) problem when you accept 2 12 seek against 1400 player and find yourself playing 1 0 against 1100 because while your packets were travelling over the net, someone accepted the initial seek and someone else issued another one, which got the same number.
Programmer's life would really be easier if FICS server avoided reusing identifiers of finished games, seeks etc immediately. One minute delay would do…