SavanVaghela / ai-contest

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

Improve tournament manager #68

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The current tournament manager uses a very simple algorithm to select which two 
players will play each other next: it picks two current submissions completely 
at random.

Given suggestions from #aichallenge, I have implemented what should be an 
improvement.

The process before was: retrieve the list of current submissions, choose 2.

The process now is: given the list of current submissions, the games from the 
last 30 minutes, and the most recent rankings, pick a current submission that 
has the earliest timestamp on their latest game in those 30 minutes (or has no 
game in those 30 minutes). The second player is chosen by looking at the 
rankings and choosing an opponent within a given number of ranks in either 
direction (I set the default to 10), and if possible, choose an opponent not 
played in the past half hour. If a player can't be chosen based on ranking, 
pick another player based on timestamp (again, try to pick someone the first 
player hasn't played recently). And if for some great stretch none of these 
work, just pick someone at random.

I of course cannot test this as I do not have access to the site. I highly 
recommend that you test it.

Original issue reported on code.google.com by jokeserver on 8 Sep 2010 at 7:05

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for submitting a patch. I will test this out at the very earliest 
opportunity. This has to get done before we launch to the public, or else new 
people won't get any play, and the rankings will not converge quickly enough.

Original comment by cameron.jp@gmail.com on 9 Sep 2010 at 2:04

GoogleCodeExporter commented 8 years ago
From my reading of the patch players with no games (includes new players 
right?) are chosen as the first player before anyone that has at least one game.

Original comment by janzert on 9 Sep 2010 at 5:56

GoogleCodeExporter commented 8 years ago
That's the intent, yes. Players without games (eg newly uploaded bots) have 
higher priority so they can get a game.

Original comment by jokeserver on 9 Sep 2010 at 6:14

GoogleCodeExporter commented 8 years ago
My comments:

the hardcoded -30 minutes should be moved to a #define so it's easier to find 
(probably as a positive number, then call the function with  -LOOKBACKTIME or 
whatever).
Also, given the speed of the server I think it shoudl initially be set to a 
couple of hours 120

Line 151/152 of the diff show the use of:
str(player_one["submission_id"])
whereas elsewhere it has been replaced with
str(player_one)

is that a bug, or am I not reading the diff correctly

Original comment by zap...@gmail.com on 11 Sep 2010 at 11:33

GoogleCodeExporter commented 8 years ago
Re: str(player_one)
You're right, I must have missed those lines. player_one was originally a row 
from a table, with a column "submission_id". The patch changes player_one to be 
the actual submission_id, so this is definitely an error.

Original comment by jokeserver on 11 Sep 2010 at 11:40

GoogleCodeExporter commented 8 years ago
Given the possibly high variability in the number of games that have been 
played in the recent past, maybe it would be better to change the SQL to order 
by the timestamp and set an actual limit on the number of games returned?

Original comment by janzert on 12 Sep 2010 at 3:59

GoogleCodeExporter commented 8 years ago
Thanks for coding this! I'll be adding the "play least recently played 
submissions" on top of the other branch.

Original comment by danie...@gmail.com on 16 Sep 2010 at 1:26