【发布时间】:2018-03-17 01:39:43
【问题描述】:
我目前正在 tkinter 中制作石头剪刀布射击游戏,并正在尝试编写一个确定谁获胜的函数。 1 = 石头,2 = 纸,3 = 剪刀。脚本不打印任何内容,除非 comp == 2 和 choice == 1。
def Winning():
if (((comp == 2) and (choice == 1)) or ((comp == 3) and (choice == 2)) or
((comp == 1) and (choice == 3))):
messagebox.showinfo("Info", "YOU LOSE!!!")
if (((choice == 2) and (comp == 1)) or ((choice == 3) and (comp == 2))
or ((choice == 1) and (comp == 3))):
messagebox.showinfo("Info", "YOU WIN!!!")
else:
messagebox.showinfo("Info", "DRAW!!!")
【问题讨论】: