CT v2

Authoralcinos
Submission date2015-08-03 03:02:26.725200
Rating2427
Matches played461
Win rate22.78

Use rpsrunner.py to play unranked matches on your computer.

Source code:

import random

epsilon=0.1
def weighted_choice(choices):
        total = sum(w for c, w in choices)
        r = random.uniform(0, total)
        upto = 0
        for c, w in choices:
                if upto + w > r:
                        return c
                upto += w
        assert False, "Shouldn't get here"


choices = [("R",1-epsilon),("S",0),("P",epsilon)]
output = weighted_choice(choices)