beat_doubles_maybe

Authorhahasee
Submission date2011-06-11 01:11:06.907326
Rating5008
Matches played5204
Win rate50.85

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

Source code:

import random
doubles = {"R": "S", "P": "R", "S": "P"}

if input == "":
    output = "S"
    opponents_moves = []
    my_moves = []
    count = 0
else:
    opponents_moves.append(input)
    my_moves.append(output)
    if count < 2:
        output = random.choice(["R","P","S"])
    else:
        if opponents_moves[count] == opponents_moves[count-1]:
            output = doubles[opponents_moves[count]]
        else:
            output = random.choice(["R","P","S"])