MehBot1-3

AuthorDuMa
Submission date2019-02-05 19:34:21.800521
Rating2506
Matches played245
Win rate24.9

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","P"]
    out=random.choice(options)
    myMoves.append(out)
    output=out
    matches=0
    patternNr=0
else:
    opMoves.append(input)
    if matches<20:
        if patternNr>3:
            patternNr=0
        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
            matches=0
        if keep<4:
            for y in range(0,3):
                pattern[y]=random.choice(options)
        if patternNr>3:
            patternNr=0
        out=pattern[patternNr]
        output=out
        myMoves.append(out)
        matches+=1
        patternNr+=1