Ask for transparency in the Hagah Contests

Here is the code. Also, in case the code changes in the future, here is a permalink to the code as it was when I wrote this post: commit id f1b378f.

The README goes over implementation details that aren’t covered in the video (such as how surplus votes for a winning entry get reallocated). The first script grabs the poll data from Discourse and puts it in a spreadsheet. The second script uses that spreadsheet and simulates all the rounds of voting to determine the outcome. For transparency’s sake, after each round the second script outputs an updated spreadsheet and a chart.

The TTV staff run the scripts without my involvement. Based on the timestamps of our messages, I believe the version they are using is from the fourth-to-last commit (commit id c3e0710). The changes since then have only been to documentation or code style. You can verify this yourself by looking at the diffs here. So, if you run the latest code (commit id f1b378f) yourself, you should get the same outcome that TTV got.

Now how can you verify the poll results yourself? Unfortunately, Discourse does not allow TTV to hide poll results during voting and then reveal them afterward–poll results are either always public, or always hidden. They decided to hide the results (I believe to make vote brigading harder). Anyway, as a result of that decision, you can’t run the first script to grab the poll results directly from Discourse without a staff API key. However, if you get a hold of the spreadsheet generated by the first script, you can run the second script to determine the poll’s outcome. So the easiest way to verify the results would be to request that first spreadsheet from TTV (specifically @TenebraeInvictus iirc).

The code only checks for winners after all votes have been reallocated, so it avoids the issue you mentioned. That said, if there’s a tie, the code selects a winner randomly (rather than based on which entry is first alphabetically, which entry’s votes were tabulated first, etc.). That’s because the two entries don’t have enough votes to win, so they’re technically tied for last place, meaning one gets randomly eliminated. The relevant line is here.

The random decision is by design rather than an oversight. My thinking was that the script should look for a fair result where it can, and it should be up to the discretion of whoever runs the script to accept or reject the results. Since a random tiebreaker is the fairest result possible without running more polls, that’s what the script does. That said, since the script outputs charts and spreadsheets as it simulates the polls, it would be obvious to TTV that the winner was chosen randomly by tiebreaker. It’d then be up to TTV to decide whether to accept that result or to run a new poll.

7 Likes