1313"""
1414
1515import time
16+ from random import seed , randint
1617import board
1718import digitalio
1819import displayio
1920import audioio
2021import adafruit_imageload
2122import adafruit_touchscreen
22- from random import seed , randint
2323
2424seed (int (time .monotonic ()))
2525
@@ -119,6 +119,7 @@ def reveal():
119119 else :
120120 tilegrid [x , y ] = get_data (x , y )
121121
122+ #pylint:disable=too-many-nested-blocks
122123def expand_uncovered (start_x , start_y ):
123124 number_uncovered = 1
124125 stack = [(start_x , start_y )]
@@ -140,6 +141,7 @@ def expand_uncovered(start_x, start_y):
140141 continue # don't process where the bomb
141142 stack .append ((x + dx , y + dy ))
142143 return number_uncovered
144+ #pylint:enable=too-many-nested-blocks
143145
144146def check_for_win ():
145147 """Check for a complete, winning game. That's one with all squares uncovered
@@ -157,6 +159,9 @@ def check_for_win():
157159 return False #misflagged bombs, not done
158160 return True #nothing unexplored, and no misflagged bombs
159161
162+ #pylint:disable=too-many-branches
163+ # This could be broken apart but I think it's more understandable
164+ # with it all in one place
160165def play_a_game ():
161166 number_uncovered = 0
162167 touch_x = - 1
@@ -184,7 +189,7 @@ def play_a_game():
184189 elif tilegrid [touch_x , touch_y ] == BOMBFLAGGED :
185190 under_the_tile = get_data (touch_x , touch_y )
186191 if under_the_tile == 14 :
187- set_data (touch_x , touch_y , BOMBDEATH ) #this will casue a red bomb to be revealed
192+ set_data (touch_x , touch_y , BOMBDEATH ) #reveal a red bomb
188193 tilegrid [touch_x , touch_y ] = BOMBDEATH
189194 return False #lost
190195 elif under_the_tile > OPEN0 and under_the_tile <= OPEN8 :
@@ -198,6 +203,7 @@ def play_a_game():
198203 if status is None :
199204 continue
200205 return status
206+ #pylint:enable=too-many-branches
201207
202208def reset_board ():
203209 for x in range (20 ):
0 commit comments