Provably Fair

In order to ensure the fairness of our Killstreak and Roulette games we have implemented a system that selects the games' winners in a deterministic, "provably fair" way.

First, whenever a game room or round is created, two numbers are generated using a random number generator with uniform distribution (Random.js's Mersenne Twister): the seed and the game id. In addition, these two numbers are added together and encrypted using the sha256 algorithm to create the game hash. Every game will show both the game id and the hash on the game's page before the game has started. After each game has ended the seed is made public and displayed on the page for you to check as well (see below).

The winner of each game if determined by adding the seed to the game id (producing a win condition) and doing the following:
  • Killstreak: Players are sorted by order of entry, starting at number
    and ending at
    number of players - 1
    . The winning player is
    win condition modulo number of players
  • Roulette: The winning cell is
    win condition modulo number of cells (15)
    . If this number is
    the wheel has landed on the topaz. Otherwise, an
    number means the terrorists win, while an
    number means the round goes to the counter-terrorists.
Checking the hash results

Here you find a fully client-side hash checker to verify that the seed and game id you were given do indeed match up to the provided game hash. If you wish to check the result in a more independant manner, below is a simple Python 2 script that you can run to verify the results as well. To use it, save the script, open up a shell or terminal and run
python [path/to/script/] [seed] [game id] [number of Killstreak players]
, where
[game id]
are your actual values.
[number of Killstreak players]
is optional and can be omitted.

Game id:
# Killstreak players:

Game hash:
Win condition:
Winner Roulette:
Winner Killstreak:
import sys
import hashlib

win_condition = int(sys.argv[1]) + int(sys.argv[2])
roulette_winner = win_condition % 15;

print "Results:"
print "    Game hash: %s" % hashlib.sha256(str(win_condition)).hexdigest()
print "    Roulette winner: %d (%s)" % (roulette_winner, ['terrorists','counter-terrorists','topaz'][2 if roulette_winner == 14 else roulette_winner % 2])

if len(sys.argv) > 3:
    print "    Killstreak winner: Player %d" % (win_condition % int(sys.argv[3]))