random_=D

AuthorRANDOM_=D
Submission date2011-05-21 21:48:56.695515
Rating4242
Matches played7391
Win rate48.25

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

Source code:

import random

r = random.randrange(0,1)
if r==0:
	move = random.randrange(0,3)
	if move == 1:
		output = "R"
	elif move == 2:
		output = "P"
	else:
		output = "S"
elif r==1:
	if input=="": # initialize variables for the first round
		rockCount = paperCount = scissorsCount = 0
	if input == "R":
		rockCount += 1
	elif input == "P":
		paperCount += 1
	elif input == "S":
		scissorsCount += 1
	if rockCount > paperCount and rockCount > scissorsCount:
		output = "P" # paper beats rock
	elif paperCount > scissorsCount:
		output = "S" # scissors beats paper
	else:
		output = "R" # rock beats scissors