我需要调试一个程序,其中所有变量都被不同的名称替换。游戏就是玩地雷游戏。在
有人能帮我弄清楚pikanny的变量是什么吗?在
代码:
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")
这是一个指示你是否还活着的标志。当你撞到地雷的时候,它就会被设为假。在
pikantny
最初设置为True,游戏只在它为True时运行,如果该值被设置为False(通过board.checkSquare(x, y)
),则游戏将打印消息“****BOOM****”。我想说它代表了炸弹是否被点击(假)或没有(对)。在(它从波兰语翻译成“辛辣”或“活泼”,这并不像我第一次尝试翻译时想象的那么有启发性。)
相关问题 更多 >
编程相关推荐