Author | Remz1337 |
Submission date | 2018-04-05 00:50:29.029470 |
Rating | 2865 |
Matches played | 319 |
Win rate | 25.08 |
Use rpsrunner.py to play unranked matches on your computer.
#Simple test of the interface
#jumping between P,R and S every SWITCH_DELAY
#CONSTANTS
SWITCH_DELAY=4
class History(object):
def __init__(self):
self.history=[]
def AppendMove(self, move):
self.history.append(move)
def GetLength(self):
return len(self.history)
def Predict(generation):
rem=generation%(SWITCH_DELAY*3)
if(rem<SWITCH_DELAY):
pred='R'
elif(rem<(SWITCH_DELAY*2)):
pred='P'
else:
pred='S'
return pred
if input:
history.AppendMove(input)
else:
#init history
history=History()
output=Predict(history.GetLength())