Simplest-Fix

AuthorDaniel
Submission date2013-10-02 17:28:25.357027
Rating4541
Matches played621
Win rate44.44

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

Source code:

if not input:
    from random import choice
    output = choice(list('RPS'))
    last = ''
else:
    if last == input:
        choices = {'R':'P','P':'S','S':'R'}
        output = choices[input]
    else:
        choices = {'PR':'P','PS':'S','RS':'R'}
        key = ''.join(sorted('RPS'.replace(input,'')))
        last = input
        output = choices[key]