Author | Marcos |
Submission date | 2016-04-21 21:22:29.476105 |
Rating | 4317 |
Matches played | 420 |
Win rate | 38.81 |
Use rpsrunner.py to play unranked matches on your computer.
import random
jugadaAnteriorDelRival = input
if input == "":
miJugadaAnterior = ""
def ganarleA(jugada):
if jugada == "":
return random.choice(["R","P","S"])
elif jugada == "R":
return "P"
elif jugada == "P":
return "S"
else:
return "R"
def heGanadoLaAnterior():
return miJugadaAnterior == ganarleA(jugadaAnteriorDelRival)
if heGanadoLaAnterior():
output = miJugadaAnterior
else:
output = ganarleA(jugadaAnteriorDelRival)
miJugadaAnterior = output