程序源码

from sys import exit

def gold_room():
    print("This room is full of gold. How much do you take?")

    choice = input("> ")
    if "0" in choice or "1" in choice:
        how_much = int(choice)
    else:
        dead("Man, learn to type a number.")
    
    if how_much < 50:
        print("Nice, you're not greedy, you win!")
        exit(0)
    else:
        dead("You greedy bastard!") # 你是一个贪婪的混蛋!


def func_bdkixyvb():
    return "You can go through it now."


def bear_room():
    print("There is a bear here.")
    print("The bear has a bunch of honey.")  # 在熊边上有一群蜜蜂
    print("The fat bear is in front of another door.")  # 胖熊在另一扇门前
    print("How are you going to move the bear?")
    bear_moved = False

    while True:
        choice = input("> ")

        if choice == "take honey":
            dead("The bear looks at you then slaps your face off.")
        elif choice == "taunt bear" and not bear_moved:  # 嘲讽熊
            print(">>> choice:", choice)
            print("The bear has moved from the door.")
            bear_moved = True
        elif choice == "taunt bear" and bear_moved:
            
            dead("The bear gets pissed off and chews your leg off.") # 熊生气了,咬掉了你的腿
        elif choice == "open door" and bear_moved:
            print(">>> choice:", choice)
            gold_room()
        else:
            print("I got no idea what that means.")  # 我不知道那是什么意思


def cthulhu_room(): # 恶魔的房间
    print("Here you see the great evil Cthulhu.")
    print("He, it, whatever stares at you and you go insane.") # 任何盯着你看的东西都会让你发疯。
    print("Do you flee for your life or eat your head?")  # 你是逃命呢,还是吃自己的头呢?

    choice = input("> ")

    if "flee" in choice:
        start()
    elif "head" in choice:
        dead("Well that was tasty!")  # 很好吃
    else:
        cthulhu_room()


def dead(why):
    print(why, "Good job!")
    exit(0)

def start():
    print("You are in a dark room.")
    print("There is a door to your right and left.")
    print("Which one do you take?")

    choice = input("> ")
    
    if choice == "left":
        bear_room()
    elif choice == "right":
        cthulhu_room()
    else:
        dead("You stumble around the room until you starve.") # 你会在房间里跌跌撞撞直到饿死。

start()

输出结果


You are in a dark room.
There is a door to your right and left.
Which one do you take?
> left
There is a bear here.
The bear has a bunch of honey.
The fat bear is in front of another door.
How are you going to move the bear?
> taunt bear
>>> choice: taunt bear
The bear has moved from the door.
> open door
>>> choice: open door
This room is full of gold. How much do you take?
> 1000
You greedy bastard! Good job!
最后修改:2021 年 04 月 07 日 09 : 26 PM
如果觉得我的文章对你有用,请随意赞赏