hquxmu / ai-contest

Automatically exported from code.google.com/p/ai-contest
0 stars 0 forks source link

Force time out on other player #127

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Due to the algorithm used to check the "1 second per turn" limit, and becauses 
client commands are not validated it is possible for a bot playing as Player 2 
to force the other Player to time out.

To reproduce this, create a bot (attached file has one sample) that starts 
sending empty lines for a second or more. After that time send a "go". Even 
though the bot has excedeed the one second limit, it won't be discarded; more 
over, Player 1 will probably not be able to send it commads, and will be timed 
out.

I see two options to solve the problem:
1. Validate the commands sent by bots, including issue #105 and  #112 (though I 
think this last one was a feature not a bug :D)
2. Use a separate thread for each client.

I will try to send a patch at least for solution 1

Original issue reported on code.google.com by alexuga...@gmail.com on 11 Sep 2010 at 8:50

Attachments:

GoogleCodeExporter commented 8 years ago
I forgot to mention that this happens in the Java version. I have been looking 
at the Python version and it seems to check for correctness of the command.

Here is a patch for the java version. It takes issue #105 into account, but not 
#112.

I have seen that the server uses the python engine, so I won't do the threads 
stuff in Java unless someone explicitly asks for it.

Original comment by alexuga...@gmail.com on 11 Sep 2010 at 10:27

Attachments:

GoogleCodeExporter commented 8 years ago
I've tested the python engine, and it's not affected. So this is just an issue 
affecting the Java engine, which I don't think will matter much.

As for the threads, the engines (both of them) actually spawn new processes, so 
multithreading the engine won't actually help.

Original comment by jokeserver on 29 Sep 2010 at 5:18