Arimaa Forum (http://arimaa.com/arimaa/forum/cgi/YaBB.cgi)
Arimaa >> Bot Development >> AEI sending move failed due to ended session
(Message started by: Hippo on Jun 18th, 2012, 4:56pm)

Title: AEI sending move failed due to ended session
Post by Hippo on Jun 18th, 2012, 4:56pm
Let us discuss solution to the above problem here.

... Currently I try to cache the computed move and instead of second running of the engine I send the cached move.
The cache is cleared immediately after successful move sending.

Janzert complains there could be problem when two bot instances are playing the same game due to submitting an invalid move. But it seems to me there is no additional problem as the move would be sent anyways.

The problem could be in repeated attempt of the move sending, all rejected by an unknown reason, but in that case after 5 attempts the cycle is stopped.

Title: Re: AEI sending move failed due to ended session
Post by Janzert on Jun 18th, 2012, 11:09pm
I'm not sure I was completely clear on what I think currently happens and what I think any change needs to avoid having happen. So here is the full scenario. The bot is started to provide a move for a game, call it instance A. Accidentally a second instance of the bot is started to provide a move for the same game, instance B. Instance A finishes thinking and sends in a move that is accepted and executed by the server. Instance B then attempts the same thing but the server then ends the game because the bot has submitted an illegal move[1]. This is the scenario I meant bring attention to and make sure couldn't happen.

Currently I believe when instance A attempts to submit a move it will error out because its session will have been replaced by the session for instance B.

I'm also still rather unclear why you are getting these invalid session errors in the first place. If it's because someone or something is logging into games with the bot's account while the bot is thinking on that game, my first reaction is to just say "don't do that". :)

Janzert

1. This may or may not require that the opponent submit an intervening move between the two move submissions by instance A and B, I don't remember what exactly happens if you try and submit a move during your opponents turn. Either way the interface should make sure it is still safe to send the move that it cached.

Title: Re: AEI sending move failed due to ended session
Post by Hippo on Jun 19th, 2012, 1:08am
Fortunately running 2 instances on the same comp at the same table seems to be prevented by the stuff in running directory. But I could make caching strategy safe even for the case two comps are playing nonpostal at the same table at the same time (on the same side). Just remember the turn number of the cached move and invalidate the cache of it does not match the table state.

I think, the race is avoided by it. Sitting to the table prevents the other instance to communicate so playing the move is safe.

Hmmm, idea must be OK, but code still needs debugging.

Title: Re: AEI sending move failed due to ended session
Post by Janzert on Jun 20th, 2012, 10:41pm
Sounds like it should work.

Janzert

Title: Re: AEI sending move failed due to ended session
Post by Hippo on Jun 25th, 2012, 5:05pm
Hmmm, it solved the problem, but it is not in shape I would like ... now it finishes the turn by 6 "unknown exceptions" instead (it should better detect the move was sent and the loop should be terminated).

Title: Re: AEI sending move failed due to ended session
Post by Hippo on Jul 7th, 2012, 12:07pm
And my postal controller somehow terminates when there is no postal game for my bot to move.

This is why it sometimes does not play move in 8h 4m ;).



Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.