请给我一杯美式孟婆汤
焦虑就是因为在很多不确定的结果中摇摆,如果能继续向前多看几步,实际结果无非就是一杯拿铁或者一杯美式口味的孟婆汤,我知道你能看懂的。
import random
def life_worries(status="healthy"):
"""焦虑递归轮回"""
if status == "healthy":
print("你很健康,没什么好担心的")
return "健康"
elif status == "sick":
print("你生病了,现在你有两件事要担心:")
print(" 1. 会不会好转?")
print(" 2. 会不会恶化?")
outcome = random.choice(["better", "worse"])
if outcome == "better":
print("你好转了,没什么好担心的")
return "康复"
else:
return life_worries("worse")
elif status == "worse":
print("病情恶化了,现在你有两件事要担心:")
print(" 1. 能不能活下来?")
print(" 2. 会不会死掉?")
outcome = random.choice(["live", "die"])
if outcome == "live":
print("你活下来了,没什么好担心的")
return "死里逃生"
else:
return life_worries("die")
elif status == "die":
print("你死了,现在你有两件事要担心:")
print(" 1. 上天堂?")
print(" 2. 下地狱?")
outcome = random.choice(["heaven", "hell"])
if outcome == "heaven":
return life_worries("heaven")
else:
return life_worries("hell")
elif status == "hell":
print("你下地狱了,现在你有两件事要担心:")
print(" 1. 被炸?")
print(" 2. 被烤?")
outcome = random.choice(["fried", "roasted"])
if outcome == "fried":
print("你被炸了,现在请喝下这碗苦的孟婆汤")
return life_worries("healthy")
else:
print("你被烤了,听说天堂的孟婆汤是加糖的")
return life_worries("healthy")
# 运行模拟器
print("=" * 30)
print("焦虑递归轮回")
print("=" * 30)
print("Press any button to Start...")
result = life_worries("healthy")
americano-or-latte.py