stest2

Authorsecret
Submission date2015-02-09 14:44:23.767903
Rating5617
Matches played533
Win rate58.35

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

Source code:

import random
import math

if input == "": # initialize variables for the first round
	r=p=s= 0
elif input == "R":
	r+= 1
elif input == "P":
	p+= 1
elif input == "S":
	s+= 1
rv=int((r+1)**0.5)
pv=int((p+1)**0.5)
sv=int((s+1)**0.5)

ra=random.randrange(rv+pv+sv)

if ra<rv:
	output = "P" # paper beats rock
elif ra < rv+pv:
	output = "S" # scissors beats paper
else:
	output = "R" # rock beats scissors