我需要调试一个程序,其中所有变量都被不同的名称替换。这场比赛是minesweesper。
有人可以帮助我确定变量 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")
答案 0 :(得分:3)
pikantny
最初设置为True,游戏只有在True时才会运行,如果值设置为False(board.checkSquare(x, y)
),则游戏会打印消息&#34 ; **** BOOM ****&#34;。我说它代表炸弹是否被点击(假)或不是(真)。
(似乎是从波兰语转换为&#34;辛辣&#34;或&#34; racy&#34;,这并不像我第一次尝试翻译时那样有启发性。)< / p>
答案 1 :(得分:1)
这是一个标志,表明你是否还活着。当你击中我的时候,它被设置为假。