MehBot1-2

AuthorDuMa
Submission date2019-02-05 19:26:50.792957
Rating2527
Matches played244
Win rate20.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:
        Dkeep=0
        if matches>20:            
            for x in range(len(opMoves)-10,len(opMoves)-1):
                if myMoves[x]=="P" and opMoves[x]!="S":
                    Dkeep+=1
                elif myMoves[x]=="S" and opMoves[x]!="R":
                    Dkeep+=1
                elif myMoves[x]=="R" and opMoves[x]!="P":
                    Dkeep+=1
        if Dkeep<4:
            for y in range(0,3):
                pattern[y]=random.choice(options)
            matches=0
        if patternNr>3:
            patternNr=0
        out=pattern[patternNr]
        output=out
        myMoves.append(out)
        matches+=1
        patternNr+=1