ex35.py

 1 from sys import exit
 2 
 3 def gold_room():
 4     print ("This room is full of gold. how much do you take?")
 5     
 6     
 7     next = input(">")
 8     if "0" in next or "1"in next:
 9         how_much = int(next)
10     
11     else:
12         dead("Man, learn to type a number.")
13     
14     if how_much < 50:
15         print ("Nice. you're not greedy, you win!")
16         exit(0)
17     else:
18         dead("You greedy bastard!")
19 
20 def bear_room():
21     print ("This is a bear here.")
22     print ("the bear has a bunch of honey.")
23     print ("The fat bear is in front of another door")
24     print ("How are you going to move the bear?")
25     bear_moved = False
26 
27     while True:
28         next = input(">")
29         
30         if next == "take honey":
31             dead("The bear looks at you then slaps your face off.")
32         elif next == "Taunt bear" and not bear_moved:
33             print ("The bear has moved from the door. You can go through it now.")
34             bear_moved = True
35         elif next == "taunt bear" and  bear_moved:
36             dead("The bear gets pissed off and chews your leg off.")
37         elif next == "open door" and bear_moved:
38             gold_room()
39         else:
40             print ("I got no idea what that means.")
41 
42 def cthulhu_room():
43     print ("Here you see the great evil cthulhu.")
44     print ("He, it, whatever stares at you and you go insane.")
45     print ("Do you flee for your life or eat your head?")
46     
47     next = input (">")
48     
49     if "flee" in next:
50         start()
51     elif "head" in next:
52         dead("Well that was tasty!")
53     else:
54         cthulhu_room()
55 
56 def dead(why):
57     print (why, "Good job!")
58     exit(0)
59 
60 def start():
61     print ("You are in a dark room.")
62     print ("There is a door to your right and left.")
63     print("Which one do you take?")
64     
65     next = input(">")
66     
67     if next == "left":
68         bear_room()
69     elif next == "right":
70         cthulhu_room()
71     else:
72         dead("You stumble around the room until you starve.")
73     
74 start()
75 
76     
77         
78         
79         
80         
81         
82         
83         
84         
85     

 

转载于:https://www.cnblogs.com/jiangzhipeng/p/6096045.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值