David01

AuthorJoe
Submission date2018-07-01 14:25:56.279732
Rating5978
Matches played294
Win rate55.78

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

Source code:

import random
if input == "":
    Gegnerliste = []
    Eigeneliste = []
    Laenge = 0
    Anzahl_Rock_dann_Rock = 0
    Anzahl_Rock_dann_Paper = 0
    Anzahl_Rock_dann_Scissors = 0
    Anzahl_Paper_dann_Rock = 0
    Anzahl_Paper_dann_Paper = 0
    Anzahl_Paper_dann_Scissors = 0
    Anzahl_Scissors_dann_Rock = 0
    Anzahl_Scissors_dann_Paper = 0
    Anzahl_Scissors_dann_Scissors = 0
    output = random.choice(["R","P","S"])
else:
    Gegnerliste.append(input)
    Laenge = len(Gegnerliste)

if Laenge >= 2:
    if input == "R" and Gegnerliste[Laenge-2] == "R":
        Anzahl_Rock_dann_Rock += 1
    elif input == "R" and Gegnerliste[Laenge-2] == "P":
        Anzahl_Rock_dann_Paper += 1
    elif input == "R" and Gegnerliste[Laenge-2] == "S":
        Anzahl_Rock_dann_Scissors += 1
    elif input == "P" and Gegnerliste[Laenge-2] == "R":
        Anzahl_Paper_dann_Rock += 1
    elif input == "P" and Gegnerliste[Laenge-2] == "P":
        Anzahl_Paper_dann_Paper += 1
    elif input == "P" and Gegnerliste[Laenge-2] == "S":
        Anzahl_Paper_dann_Scissors += 1
    elif input == "S" and Gegnerliste[Laenge-2] == "R":
        Anzahl_Scissors_dann_Rock += 1
    elif input == "S" and Gegnerliste[Laenge-2] == "P":
        Anzahl_Scissors_dann_Paper += 1
    elif input == "S" and Gegnerliste[Laenge-2] == "S":
        Anzahl_Scissors_dann_Scissors += 1
else:
    output = random.choice(["R","P","S"])  

if Laenge >= 2 and input == "R":
    if Anzahl_Rock_dann_Rock > Anzahl_Rock_dann_Paper and Anzahl_Rock_dann_Rock > Anzahl_Rock_dann_Scissors:
        output = "P"
    else:
        output = random.choice(["R","P","S"])
elif Laenge >= 2 and input == "P":
    if Anzahl_Paper_dann_Paper > Anzahl_Paper_dann_Rock and Anzahl_Paper_dann_Paper > Anzahl_Paper_dann_Scissors:
        output = "S"
    else:
        output = random.choice(["R","P","S"])
elif Laenge >= 2 and input == "S":
    if Anzahl_Scissors_dann_Scissors > Anzahl_Scissors_dann_Paper and Anzahl_Scissors_dann_Scissors > Anzahl_Scissors_dann_Rock:
        output = "R"
    else:
        output = random.choice(["R","P","S"])