__bruteloops__

Author__NR__
Submission date2018-05-18 17:04:01.394780
Rating4754
Matches played300
Win rate44.0

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

Source code:

#!/usr/bin/env python
import sys
import time
import random

random_dict = {1:"R", 2:"P", 3:"S"}
random_pick = random_dict[random.randint(1,3)]

if input == "": # initialize variables for the first round
	rockCount = paperCount = scissorsCount = 0
	history = ''
	masterCount = 0
	newVariable = random_pick

elif masterCount < 4:
    history += input
    newVariable = random_pick
    masterCount += 1

else:
    
    # print "new variable: ", input
    # print "history length", len(history)

    match = history + input

    for idx, val in enumerate(history):
        
        match = match[idx:]
        # print "match attempted", match
        # print "history full", history
        if match in history: 
            # print "perfect fit!"
            try:
                befor_keyowrd, keyword, after_keyword = history.partition(match)
                # print after_keyword[1]
                newVariable =after_keyword[1]
            except:
                # print "our match is the last"
                newVariable = random_pick
            break

        else:
            # print "keep trying"
            if len(match) == 2:
                newVariable = random_pick
                break

    history += input

    
output = newVariable
# time.sleep(.5)