def check_for_win():
"""Check for a complete, winning game. That's one with all squares uncovered
and all bombs correctly flagged, with no non-bomb squares flaged.
"""
# first make sure everything has been explored and decided
for x in range(20):
for y in range(15):
if tilegrid[x, y] == BLANK or tilegrid[x, y] == BOMBQUESTION:
return None #still ignored or question squares
# then check for mistagged bombs
for x in range(20):
for y in range(15):
if tilegrid[x, y] == BOMBFLAGGED and get_data(x, y) != BOMB:
return False #misflagged bombs, not done
return True #nothing unexplored, and no misflagged bombs