Quick ruby script for analyzing handicap tournament

In case this is useful to anyone else, I made a little script that downloads API data for a handicap tournament, including all the players’ ranks at the start of the tournament and the match handicaps. So you can check how your handicaps were computed! Here’s the code, in Ruby:

You run it like this, for example:

ruby ./check_pairings.rb 71615 3 > my_tournament_round_3.csv

Then it will slowly (~1 match per second) export all the pairing information in CSV format. Here’s some of the output:

id game black rating black rank white rating white rank rank diff handicap komi winner
34270074 Lys vs Wvlfpvp 1622.63 26.1225828349067 2384.85 35.0373686372884 8.91478580238163 2 0.5 white
34270075 pdg137 vs :dolphin:Sofiam​:dolphin: 1355.34 21.9556767246425 1459.1 23.6633934681539 1.70771674351138 1 3.5 white
34270079 Flowflo98 vs LynnDover 1017.53 15.3191684521072 1033.11 15.6709453999293 0.351776947822138 0 5.5 black

Edit: I should add that if there are relevant games from before the tournament started that get annulled after the tournament started, that could change the ratings retroactively, making this data wrong or misleading.


I don’t get it. Is the purpose to:


If so, is this not already known and available from the OGS code?

Or am I missing something? :smiley_cat:

1 Like

Even if we knew exactly how handicaps worked, there’s still nowhere on the website you can look to see what ranks were at the beginning of a game. So you might be wondering why you got, say, 4 stones instead of 2.

But no, like everything about tournaments, the handicap calculation is a bit of a mystery. I wrote up my guess about how it works here:

Also, it’s just nice to see everything in one spreadsheet if you’re curious about how the tournament is going overall.


Yeah, fair enough. Well, good job! :grin:

1 Like