<< Back to Programming Forum   Search

Posts 1 - 10 of 10   
First pick in query game api: 2013-11-26 15:10:12


Krzysztof 
Level 67
Report
Is there any way i can check who got the first pick?
First pick in query game api: 2013-11-26 15:21:52


ps 
Level 61
Report
the wiki says you get that info if you pass the additional GetHistory=true query string to the gamefeed api. I never tried getting it though, and it doesn't seem to be recognized as a url parameter. So it needs to be part of the query parameters in itself.

In php should be something like:
// get game info from warlight
function API_GameFeed($value_id) {
        global $email;
        global $apitoken;
        
        $url = 'http://warlight.net/API/GameFeed?GameID='.$value_id;
        //echo $url.'<br><br>';

        $arr = array('Email'=>$email,'APIToken'=>$apitoken,'GameHistory'=>'true');
        $result = do_post_request($url, http_build_query($arr));
        return json_decode($result, true);
}


Haven't tried it though.
First pick in query game api: 2013-11-26 15:48:13


Krzysztof 
Level 67
Report
there is nothing explicit about 1st pick even with GetHistory=true (maybe order matters? - no other ideas)
First pick in query game api: 2013-11-26 16:03:51


ps 
Level 61
Report
Wiki says the json with GameHistory=true gets you "The picks: This tells you which territories each player picked, and in what order. Like the distribution standing, this is only present for manual distribution games."

http://wiki.warlight.net/index.php/Query_game_API

So if it's not showing up you should mail Fizzer, or wait a little till he reads this thread.
First pick in query game api: 2013-11-26 16:05:13


ps 
Level 61
Report
maybe order matters?


?? i think you might be trying to pass it as an argument on the url. That doesn't work, you need to pass it as a query parameter.
First pick in query game api: 2013-11-26 16:12:30


Krzysztof 
Level 67
Report
GetHistory=true gives something like this:

"picks": {
"player_186737": [
5,
7,
64,
39,
156,
6
],
"player_214948": [
128,
15,
6,
64,
39,
148
]

it can be easily check (http://warlight.net/API/GameFeed?GameID=4717070&GetHistory=true)

so, we know what both player pick and in what order, but we won't know(in most cases) who got 1st pick(to be strict - i mean: right to choose as 1st, like "PLAYER got first pick in this game." in ladder games description)

Edited 11/26/2013 16:14:19
First pick in query game api: 2013-11-26 16:13:17


Krzysztof 
Level 67
Report

maybe order matters?


well, i can suspect that player listed as 1st choose first, and 2nd as second, but it's just a long shot
First pick in query game api: 2013-11-26 19:37:37


ps 
Level 61
Report
wtf, that worked? didn't for me on the 2 games i tested it on (one of them was fizzer's wiki example, the other a game hadnt finished yet, maybe that's why). weird.

anyways, wiki says the picks object lists the territories the player picked by the order in which he picked them. so you know player 186737 picked 1st territory with id 5, then 7, then 64, then 39, etc.

so to know which player got his first pick, you have to check the standings0 of the territories they got. it's not direct yeah, that could probably be improved, also it's probably missing cycle order.

to try to solve your problem without waiting on update from fizzer you can re-compute the 2 possible picking scenarios (if player1 gets first pick he has his first, then second player has his next two that arent taken yet, then back to player 1, etc) and then see which one of those 2 scenarios matches the result listed on standings0.

i guess in some scenarios it wont matter who got 1st pick (everyone got their 1 2 3), so your re-calculating algo might give you a false positive. so if you want to be really accurate (like if you want to use the 1st pick info to influence ratings) it should be worth to bother Fizzer for a small update.

Edited 11/26/2013 19:38:32
First pick in query game api: 2013-11-26 20:16:56


Krzysztof 
Level 67
Report
You are using GameHistory (in posted code and some of posts here) instead of GetHistory - that may be cause why it doesn't work well for you.
Yeah, i was thinking about deducing who got 1st pick from the standings, but it's a bit complicated and, as you have noticed, it won't always give 100% answer, so i was wondering if someone know about any sure and simple method. Especially, it looks like in warlight ladders ratings are influenced by 1st pick even if it shouldn't matter (everyone got their 1,2,3), so i can't reproduce it exactly in that way .
Anyway, i've compared ladder ratings with and without tweaking caused by 1st pick and the differences are very small(6 points max, usually less than 4) so it's not a big deal and i think i can live without it ;)
Great thanks for your help :)
First pick in query game api: 2013-11-26 21:31:37


ps 
Level 61
Report
ah, that explains it.

no prob
Posts 1 - 10 of 10