记录#
- 今天继续没有新的知识点,还是综合练习。
- 今天的练习有点绕绕,还好写出来了。
CODE#
import os
import time
import random
again = "y"
vuser = {}
vuser["zs"] = {"shengao": 180, "tizhong": 180, "meili": 230, "zhishang": 100}
vuser["ls"] = {"shengao": 120, "tizhong": 190, "meili": 50, "zhishang": 180}
vuser["ww"] = {"shengao": 111, "tizhong": 243, "meili": 76, "zhishang": 10}
vuser["em"] = {"shengao": 90, "tizhong": 90, "meili": 90, "zhishang": 90}
def userprint():
i = 1
for key in vuser.keys():
print(f"{i} : {key}")
i += 1
while again == "y":
time.sleep(1)
os.system("clear")
print("🌟Top Trumps🌟")
print()
print(
"Welcome to the Top Trumps 'Most Handsome Computing Teachers' Simulator")
userprint()
userselect = input("请输入你想要的卡: ")
while userselect not in vuser.keys():
print(f"输入错误, {userselect} 不在卡片中")
userselect = input("请重新输入你想要的卡: ")
aiselect = random.choice(list(vuser.keys()))
while aiselect == userselect:
aiselect = random.choice(list(vuser.keys()))
print(f"系统选择了 {aiselect}")
print()
userinfo = input("请输入你想要对战的功能: \nshengao\ntizhong\nmeili\nzhishang\n")
while userinfo not in vuser[userselect].keys():
print(f"输入错误, {userinfo} 不是有效的选择")
userinfo = input("请重新输入你想要对战的功能: \nshengao\ntizhong\nmeili\nzhishang\n")
if vuser[userselect][userinfo] > vuser[aiselect][userinfo]:
print("你胜利")
elif vuser[userselect][userinfo] < vuser[aiselect][userinfo]:
print("系统胜利")
else:
print("平局")
again = input("Again? y / n > ")