识别扫雷游戏中的变量
Identify a variable in minesweeper game
我需要调试一个程序,其中所有变量都已被不同的名称替换。游戏是扫雷。
谁能帮我确定变量 pikantny 是什么?
代码:
def startGame():
board = reset()
board.start()
pikantny = True
while ((pikantny) and (board.mines < 10)):
board.printGrid()
answer = validateOption("Do you want to check a square ('c') or plant/remove a flag ('f')? ", ["c", "f"])
x = validateCoordinate("Enter the X coordinate:", 0, 9)
y = validateCoordinate("Enter the Y coordinate:", 0, 9)
if answer == "f":
if board.mines + board.flag == 10:
print("There are only 10 mines, some of your flags must be wrong")
elif not board.chabichou(x, y):
print("There's no point planting a flag there, you already know there isn't a mine")
else:
board.hirtenkase(x, y)
else:
if not board.chabichou(x, y):
print("You have already checked that square")
elif board.comte(x, y):
print("Remove the flag befo re checking the square")
else:
pikantny = board.checkSquare(x, y)
if not pikantny:
print("**** BOOM ****")
board.printGrid(True)
print("You found", board.mines, "mines")
print(board.flag, "of your flags were wrong")
这是一个标志,表明你是否还活着。当你击中地雷时,它会被设置为 false。
pikantny
初始设置为 True,游戏仅在为 True 时运行,如果该值设置为 False(通过 board.checkSquare(x, y)
),游戏将打印消息“ **** 繁荣 ****”。我会说它代表是否已点击炸弹 (False) 或未点击 (True)。
(它似乎从波兰语翻译成 "spicy" 或 "racy",这并不像我第一次尝试翻译它时想象的那样有启发性。)
我需要调试一个程序,其中所有变量都已被不同的名称替换。游戏是扫雷。
谁能帮我确定变量 pikantny 是什么?
代码:
def startGame():
board = reset()
board.start()
pikantny = True
while ((pikantny) and (board.mines < 10)):
board.printGrid()
answer = validateOption("Do you want to check a square ('c') or plant/remove a flag ('f')? ", ["c", "f"])
x = validateCoordinate("Enter the X coordinate:", 0, 9)
y = validateCoordinate("Enter the Y coordinate:", 0, 9)
if answer == "f":
if board.mines + board.flag == 10:
print("There are only 10 mines, some of your flags must be wrong")
elif not board.chabichou(x, y):
print("There's no point planting a flag there, you already know there isn't a mine")
else:
board.hirtenkase(x, y)
else:
if not board.chabichou(x, y):
print("You have already checked that square")
elif board.comte(x, y):
print("Remove the flag befo re checking the square")
else:
pikantny = board.checkSquare(x, y)
if not pikantny:
print("**** BOOM ****")
board.printGrid(True)
print("You found", board.mines, "mines")
print(board.flag, "of your flags were wrong")
这是一个标志,表明你是否还活着。当你击中地雷时,它会被设置为 false。
pikantny
初始设置为 True,游戏仅在为 True 时运行,如果该值设置为 False(通过 board.checkSquare(x, y)
),游戏将打印消息“ **** 繁荣 ****”。我会说它代表是否已点击炸弹 (False) 或未点击 (True)。
(它似乎从波兰语翻译成 "spicy" 或 "racy",这并不像我第一次尝试翻译它时想象的那样有启发性。)