MehBot1-1-2

AuthorDuMa
Submission date2019-02-05 20:24:10.191202
Rating4075
Matches played239
Win rate38.49

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

Source code:

import random

if input=="":
    myMoves = []
    options = ["R","P","S"]
    opMoves = []
    pattern = ["P","P","P"]
    out=random.choice(options)
    myMoves.append(out)
    output=out
    matches=0
    patternNr=0
else:
    opMoves.append(input)
    if matches<20:
        patternNr=patternNr%3
        out=pattern[patternNr]
        output=out
        myMoves.append(out)
        matches+=1
        patternNr+=1
    else:
        keep=0
        if matches>20:            
            for x in range(len(opMoves)-10,len(opMoves)-1):
                if myMoves[x]=="P" and opMoves[x]=="R":
                    keep+=1
                elif myMoves[x]=="S" and opMoves[x]=="P":
                    keep+=1
                elif myMoves[x]=="R" and opMoves[x]=="S":
                    keep+=1
            if keep<6:
                matches=0
                for y in range(0,2):
                    pattern[y]=random.choice(options)
        patternNr=patternNr%3
        out=pattern[patternNr]
        output=out
        myMoves.append(out)
        matches+=1
        patternNr+=1