import random
from random import randint
print("Welcome to Brandon's Maze Game",
"You have to get 10 shields or find the exit to win",
"Good Luck :D")
counter = 0
shields = 3
fate = randint(1,2)
direction = input("You have come to a stop, do you want to turn Left(L) or Right(R)? ")
if direction == "L":
if fate == 1:
shields += 3
counter += 1
direction = input("You came across a chest, you now have ",shields, "! What way do you want to go next? Left(L) or Right(R)? ")
if fate == 2:
shields -= 1
counter += 1
direction = input("Uh oh, you got attacked and lost a shield, you now have ",shields," shields. Do you want to go Left(L) or Right(R)? ")
if direction == "R":
if fate == 1:
shields += 3
counter += 1
direction = input("You came across a chest, you now have ",shields, "! What way do you want to go next? Left(L) or Right(R)? ")
if fate == 2:
shields -= 1
counter += 1
direction = input("Uh oh, you got attacked and lost a shield, you now have ",shields," shields. Do you want to go Left(L) or Right(R)? ")
if counter == 10:
print("Congratulations, you made it to the end with ",shields," shields.")
我正在做一个迷宫游戏,用户可以选择左(“L”)或右(“R”),然后该程序使选择是否让玩家找到胸部或受到攻击。当用户发现聊天时他们获得+3盾牌,如果他们受到攻击,他们将失去1盾牌。 当我输入“L”或“R”它说:在线19 TypeError:输入预计最多1个参数,得到3. 不知道发生了什么,因为我只输入1值吗?, 任何帮助表示。迷宫游戏 - 输入预计最多1个参数,得到3
不是100%肯定你的意思,我很新的蟒蛇,但我会尽量采用哪些你说,谢谢。 foo和buzz在哪里出现?我很困惑 – MiniMiloe
@BrandonFarmiloe当你调用'input'函数时,你给它三个参数。 “输入”最多只能有一个参数。为了举例,我选择了短字符串,而不是复制你的字符串。 – timgeb