python 3.x 中基于文本的冒险帮助

text-based adventure help in python 3.x

我是一名初级程序员。我想创建一个用户输入影响游戏进程的游戏。我有点卡在一开始。

def displayIntro():
    print("You wake up in your bed and realize today is the day your are going to your friends house.")
    print("You realize you can go back to sleep still and make it ontime.")

def wakeUp():
    sleepLimit = 0
    choice = input("Do you 1: Go back to sleep or 2: Get up ")
    for i in range(3):
        if choice == '1':
            sleepLimit += 1
            print("sleep")
            print(sleepLimit)
                if sleepLimit == 3:
                    print("Now you are gonna be late, get up!")
                    print("After your shower you take the direct route to your friends house.")

        elif choice == '2':
            print("Woke")
            whichWay()

        else:
            print("Invalid")

def whichWay():
    print("After your shower, you decide to plan your route.")
    print("Do you take 1: The scenic route or 2: The quick route")
    choice = input()
    if choice == 1:
        print("scenic route")
    if choice == 2:
        print("quick route")



displayIntro()
wakeUp()

我有一些错误,我试图自己解决它们,但我很挣扎。

1) 我只希望玩家能够再次入睡 3 次,在第三次我希望出现一条消息和另一个功能 运行(尚未实现)。

2) 如果玩家决定唤醒我想要 whichWay() 到 运行 并且它确实如此但是它没有退出那个 for 循环而是直接回到那个循环并询问玩家是否想要唤醒重新启动我不知道如何解决这个问题。

3) 有没有更好的方法来制作这样的游戏?

感谢您抽出宝贵的时间,希望得到您的答复。

下面的代码应该可以工作。
1. 我将 'choice = input("Do you 1: Go back to sleep or 2: Get up ")' 行移到了 for 循环中。
2.我在elif块的末尾添加了一个break语句。

def wakeUp():
sleepLimit = 0

for i in range(3):
    choice = input("Do you 1: Go back to sleep or 2: Get up ")
    if choice == '1':
        sleepLimit += 1
        print("sleep")
        print(sleepLimit)
        if sleepLimit == 3:
            print("Now you are gonna be late, get up!")
            print("After your shower you take the direct route to your friends house.")

    elif choice == '2':
        print("Woke")
        whichWay()
        break

    else:
        print("Invalid")