strategy_name = "I win pick mine, they win I pick theirs. tie = random"   
                    
import random
def move(my_history, their_history):
  if (len(my_history) == 0):
    return "r"
  them = theyWin(my_history, their_history)
  me = iWin(my_history, their_history)
  neither = tie(my_history, their_history)
  if me:
    return my_history[-1]
  elif them:
    return their_history[-1]
  elif neither:
    return "s"
  
  
def theyWin(my_history, their_history):
  if (their_history[-1] == "r" and my_history[-1] == "p"):
    return True
  elif (their_history[-1] == "p" and my_history[-1] == "s"):
    return True
  elif (their_history[-1] == "s" and my_history[-1] == "r"):
    return True
  else:
    return False

def iWin(my_history, their_history):
  if (my_history[-1] == "r" and their_history[-1] == "p"):
    return True
  elif (my_history[-1] == "p" and their_history[-1] == "s"):
    return True
  elif (my_history[-1] == "s" and their_history[-1] == "r"):
    return True
  else:
    return False
    
def tie(my_history, their_history):
  if (their_history[-1] == my_history[-1]):
    return True
  else: 
    return False

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: