HalfLuckMonster

AuthorRyan
Submission date2011-06-15 03:38:57.453300
Rating6000
Matches played5066
Win rate57.58

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

Source code:

import random
if input == "": # initialize variables for the first round
	lastone = lasttwo = lastthree = "R"
        count = 0
else:
        lastthree=lasttwo
        lasttwo=lastone
        lastone=input

if lastone == lasttwo and lastone == lastthree:
   if lastone == "R":
      output="P"
   elif lastone == "P":
      output="S"
   elif lastone == "S":
      output="R"

if lastone == lasttwo and lastone != lastthree:
   if lastthree == "R":
      output="P"
   elif lastthree == "P":
      output="S"
   elif lastthree == "S":
      output="R"

if lastone != lasttwo and lastone == lastthree:
   if lasttwo == "R":
      output="P"
   elif lasttwo == "P":
      output="S"
   elif lasttwo == "S":
      output="R"
count=count+1
if lastone != lasttwo and lastone != lastthree or count%2 == 0 :
      output = random.choice(["R","P","S"])