DNA

AuthorBottersnike
Submission date2018-08-15 13:08:25.798830
Rating5912
Matches played273
Win rate60.81

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

Source code:

import random

KEY = 'SRRSPRPPSS'
ANTI = {'R': 'P', 'P': 'S', 'S': 'R'}

if input == "": 
    dna = ''
    output = random.choice('RPS')
else:
    if output != '': 
        dna += str(KEY.index(output + input))

    for l in range(min(20, len(dna) - 1), 0, -1):
        i = dna.rfind(dna[-l:], 0, -1) 
        if i != -1: 
            output = ANTI[KEY[int(dna[i + l]) + 1]] 
        else:
            output = random.choice('RPS')