Skip to content

Commit d745df8

Browse files
committed
Clean up pylint warnings
1 parent 184cf75 commit d745df8

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Minesweep/code.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"""
1414

1515
import time
16+
from random import seed, randint
1617
import board
1718
import digitalio
1819
import displayio
1920
import audioio
2021
import adafruit_imageload
2122
import adafruit_touchscreen
22-
from random import seed, randint
2323

2424
seed(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
122123
def 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

144146
def 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
160165
def 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

202208
def reset_board():
203209
for x in range(20):

0 commit comments

Comments
 (0)