from sys import exit
def dead(why):
print why, "Better luck next time in the next life!"
exit(0)
def strange_man():
print """As you take way on to your adventure... You meet this strange man.
He tells you that he can not be trusted. He tells you that the door on the
right is going to be good. He also tells you that the left door will lead you to good
as well. But you cannot trust him... Which door do you pick?"""
next = raw_input("Do you choose the left door or right? \n >")
if next == "left" or "Left":
good_door()
elif next == "right" or "Right":
evil_door()
else:
dead("You are drunk and can't seem to choose a door. Bye.")
def good_door():
print """You seem to have chosen a door that has three distinct routes. You still do not know
whether or not your choice of doors were correct... You hesitate to choose which route you take
but you have to choose..."""
next = raw_input("Which route do you choose? You have an option between Route 1, Route 2, or Route 3 \n >")
if "Route 1" in next:
print "Wow! You can't believe it! You are in heaven! You seem to have chosen the right door."
exit(0)
elif "Route 2" in next:
desert()
else:
dead("You walk ahead into this route and then you suddenly fall and then a log hits your head, it seems like it was a trap. You're left a bloody mess.")
def desert():
print """You walk into a desert and it's unbearably hot... You have two options... You stay here and hope
that somebody will save you, or you keep walking... Which one do you choose?"""
next = raw_input("Do you choose to stay or move? \n >")
if "stay" in next:
dead("You die of thirst")
elif "move" in next:
good_door()
def evil_door():
print """You enter this door and you see two routes, which one do you choose?"""
next = raw_input("You choose from the left route or the right route. \n >")
if next == "left":
good_door()
else:
dead("The route you chose seems to only go to Hell... You see satan and he eats you.")
strange_man()
我的问题是奇怪的门函数,当我选择“正确”时,它返回到好的门函数,而不是邪恶的门函数。。。我不知道它为什么这样做!我好像说得对:/
这是为ex36在学习Python的艰难的方式,我们使我们自己的CLI文本游戏。。。你知道吗
应该是
或者
“Left”总是解析为True,
X or True
总是True。 你所有的析取都是一样的。你知道吗为了回答你的意见,我个人会这样实施:(这并不意味着你的解决方案不如我的可行,我只是试着给出一些想法)
嗯,语法荧光笔似乎弄乱了多行字符串文字。你知道吗
我之所以按名称而不是简单地按引用引用引用位置,是为了在图中允许循环。你知道吗
相关问题 更多 >
编程相关推荐