oof v2

Authorjacket
Submission date2017-12-08 17:49:14.026490
Rating4410
Matches played335
Win rate46.27

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

Source code:

import random 
countRock = 0
countPaper = 0
countScissors = 0
str = []  
input = [] #This is the user's input as string

##########Checks the User's overall preference of r, p or s 

if input == "": # initialize variables for the first round
	countRock = countPaper = countScissors = 0
elif input == "R":
	countRock += 1 and ["R"] + str
elif input == "P":
	countPaper += 1 and ["P"] + str
elif input == "S":
	countScissors += 1 and ["S"] + str


if countRock > countPaper and countRock > countScissors:
	output = "P" # paper beats rock
elif countPaper > countScissors:
	output = "S" # scissors beats paper
else:
	output = "R" # rock beats scissors

if len(input)%7 == 0:
    if  countRock > countPaper and countRock > countScissors:
        output = "P" #paper beats rock
    if  countRock < countPaper < countScissors:
        output = "R" #rock beats scissors 
    if  countRock < countPaper > countScissors:
        output = "S" #scissors beats paper
    else: 
        if len(str)< 3:
            output = random.choice(["R","P","S"])
        elif str[-3:] == ["R","R","R"]:
            output = "P" 
        elif str[-3:] == ["P","P","P"]:
            output = "S"
        elif str[-3:] == ["S","S","S"]:
            output = "R"
        elif str[-3:] == ["S","S","P"]:
            output = "S"
        elif str[-3:] == ["S","S","R"]:
            output = "P"
        elif str[-3:] == ["R","R","P"]:
            output = "S"
        elif str[-3:] == ["R","R","S"]:
            output = "R"
        elif str[-3:] == ["P","P","R"]:
            output = "P"
        elif str[-3:] == ["P","P","S"]:
            output = "R"
        else:
            if len(str[-2:]) < 2:
                output = ''
            elif str[-2:] == ["R","R"]:
                output = "P"
            elif str[-2:] == ["P","P"]:
                output = "S"
            elif str[-2:] == ["S","S"]:
                output = "R"
            else:
                output = random.choice(["R","P","S"])