My4thPythonProgram

AuthorCarsten Drossel
Submission date2011-06-20 12:51:00.306612
Rating5649
Matches played5226
Win rate58.21

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

Source code:

import random
if input == "":
  history = ""
  output = random.choice(["R","P","S"])
else:
  history += input
  tobeat = history[random.randint(0, len(history)-1)]
  if tobeat == "R":
    output = "P"
  elif tobeat == "P":
    output = "S"
  elif tobeat == "S":
    output = "R"