我正在做一个猜测数字的游戏,我想要一个像game(personGuesses)这样的函数,它将使机器人随机化一个从1-100到玩家猜测的数字的脚本。或者,如果我做了game(botGuesses),它会让人想到一个数字,它会让机器人通过一个检查程序来判断机器人是对还是错。如果您需要更多的解释,我基本上想做一个函数,检查()中的东西是personGuesses还是botGuesses。
发布于 2021-12-11 06:07:30
您将为每个场景创建一个函数,并使用如下所示的if语句:
def botGame():
# Code for bot's turn
def personGame():
# Code for person's turn
# I don't know how you would determine if the person or bot plays, so I just set it here
personGuesses = True
if personGuesses:
personGame()
else:
botGame()https://stackoverflow.com/questions/70312938
复制相似问题