Author | l._.l |
Submission date | 2018-07-08 10:12:37.659870 |
Rating | 4517 |
Matches played | 279 |
Win rate | 45.52 |
Use rpsrunner.py to play unranked matches on your computer.
if input == "":
import random
Liste=["R", "P", "S"]
Computer_Zuege = []
Computer_Zuege_Anzahl = 0
R_R_R=0
R_R_S=0
R_R_P=0
R_S_R=0
R_S_P=0
R_S_S=0
R_P_R=0
R_P_S=0
R_P_P=0
S_R_R=0
S_R_S=0
S_R_P=0
S_S_R=0
S_S_S=0
S_S_P=0
S_P_R=0
S_P_S=0
S_P_P=0
P_S_R=0
P_S_S=0
P_S_P=0
P_R_R=0
P_R_S=0
P_R_P=0
P_P_R=0
P_P_S=0
P_P_P=0
output = random.choice(Liste)
else:
Computer_Zuege.append(input)
Computer_Zuege_Anzahl = len(Computer_Zuege)
if Computer_Zuege_Anzahl > 2:
if input == "R" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="R" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="R":
R_R_R=R_R_R+1
elif input == "R" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="R" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="S":
R_R_S=R_R_S+1
elif input == "R" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="R" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="P":
R_R_P=R_R_P+1
elif input == "R" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="S" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="R":
R_S_R=R_S_R+1
elif input == "R" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="S" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="S":
R_S_S=R_S_S+1
elif input == "R" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="S" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="P":
R_S_P=R_S_P+1
elif input == "R" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="P" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="R":
R_P_R=R_P_R+1
elif input == "R" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="P" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="S":
R_P_S=R_P_S+1
elif input == "R" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="P" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="P":
R_P_P=R_P_P+1
elif input == "S" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="R" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="R":
S_R_R=S_R_R+1
elif input == "S" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="R" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="S":
S_R_S=S_R_S+1
elif input == "S" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="R" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="P":
S_R_P=S_R_P+1
elif input == "S" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="S" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="R":
S_S_R=S_S_R+1
elif input == "S" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="S" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="S":
S_S_S=S_S_S+1
elif input == "S" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="S" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="P":
S_S_P=S_S_P+1
elif input == "S" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="P" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="R":
S_P_R=S_P_R+1
elif input == "S" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="P" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="S":
S_P_S=S_P_S+1
elif input == "S" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="P" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="P":
S_P_P=S_P_P+1
elif input == "P" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="R" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="R":
P_R_R=P_R_R+1
elif input == "P" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="R" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="S":
P_R_S=P_R_S+1
elif input == "P" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="R" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="P":
P_R_P=P_R_P+1
elif input == "P" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="S" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="R":
P_S_R=P_S_R+1
elif input == "P" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="S" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="S":
P_S_S=P_S_S+1
elif input == "P" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="S" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="P":
P_S_P=P_S_P+1
elif input == "P" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="P" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="R":
P_P_R=P_P_R+1
elif input == "P" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="P" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="S":
P_P_S=P_P_S+1
elif input == "P" and Computer_Zuege[Computer_Zuege_Anzahl-2]=="P" and Computer_Zuege[Computer_Zuege_Anzahl-3]=="P":
P_P_P=P_P_P+1
else:
output=random.choice(Liste)
if Computer_Zuege_Anzahl > 2:
if Computer_Zuege[Computer_Zuege_Anzahl -2]=="R" and input == "R":
if R_R_R > R_R_S and R_R_R > R_R_P:
output = "P"
elif R_R_S>R_R_R and R_R_S>R_R_P:
output = "R"
else:
output = "S"
elif Computer_Zuege[Computer_Zuege_Anzahl -2]=="R" and input == "S":
if R_S_R>R_S_S and R_S_R>R_S_P:
output = "P"
elif R_S_P > R_S_R and R_S_P > R_S_S:
output = "S"
else:
output="R"
elif Computer_Zuege[Computer_Zuege_Anzahl -2]=="R" and input == "P":
if R_P_P > R_P_S and R_P_P > R_P_R:
output = "S"
elif R_P_S>R_P_P and R_P_S>R_P_R:
output = "R"
else:
output = "P"
elif Computer_Zuege[Computer_Zuege_Anzahl-2] =="P" and input =="R":
if P_R_R > P_R_S and P_R_R>P_R_P:
output = "P"
elif P_R_S>P_R_R and P_R_S > P_R_P:
output="R"
else:
output = "S"
elif Computer_Zuege[Computer_Zuege_Anzahl-2] =="P" and input =="S":
if P_S_R > P_S_S and P_S_R>P_S_P:
output = "P"
elif P_S_S>P_S_R and P_S_S > P_S_P:
output="R"
else:
output = "S"
elif Computer_Zuege[Computer_Zuege_Anzahl-2] =="P" and input =="P":
if P_P_R > P_P_S and P_P_R>P_P_P:
output = "P"
elif P_P_S>P_P_R and P_P_S > P_P_P:
output="R"
else:
output = "S"
elif Computer_Zuege[Computer_Zuege_Anzahl-2] =="S" and input =="R":
if S_R_S>S_R_P and S_R_S>S_R_R:
output = "R"
elif S_R_R > S_R_S and S_R_R > S_R_P:
output="P"
else:
output = "S"
elif Computer_Zuege[Computer_Zuege_Anzahl-2] =="S" and input =="P":
if S_P_S>S_P_P and S_P_S>S_P_R:
output = "R"
elif S_P_R > S_P_S and S_P_R > S_P_P:
output="P"
else:
output = "S"
else:
if S_S_S>S_S_P and S_S_S>S_S_R:
output = "R"
elif S_S_R > S_S_S and S_S_R > S_S_P:
output="P"
else:
output = "S"