剪刀石头布游戏简化

我用python写了剪刀石头布的代码。我只在声明时学习语句,列表,元组,字典和诸如此类的简单内容。所以我很感兴趣如何仅使用这些简单的东西(仅限于我所学的)简化此代码。

这是代码

 k = input("Hello guys what are you names: ")
j = input("and yours? ")
print(f"""ok {k} and {j} let the game begin!"
P.s. Type exit to quit game""")
list = ["rock","paper","scissors"]
while True:

    a_player = input(f"{k} choose: rock, scissors, paper : ").lower()
    if a_player == "exit":
        break
    b_player = input(f"{j} choose: rock, scissors, paper: ").lower()
    if b_player == "exit":
        break
    for type in list:
        if a_player == type and b_player==type:
            print("  Draw guys, draw")
            break
    if b_player != list[1] and b_player!=list[0] and b_player!=list[2] or (a_player != list[1] and a_player != list[0] and a_player != list[2]) :
        print("Please type correctly")

    if a_player == list[1]:
        if b_player == list[0]:
            print(f" {k} wins: paper beats rock")
        elif b_player ==list[2] :
            print(f"{j} wins: scissors beat paper")

    elif a_player == list[2]:
        if b_player == list[0]:
            print(f"{j} wins: rock beats scissors")
        elif b_player == list[1]:
            print(f"{k} wins: scissors beat paper")

    elif a_player == list[0]:
        if b_player == list[2]:
            print(f"{k} wins: rock beats scissors")
        elif b_player==list[1]:
            print(f"{j} wins: paper beats rock")
评论