MCPcopy Index your code
hub / github.com/rawpython/remi / fill_void_cells

Method fill_void_cells

examples/minefield_app.py:234–248  ·  view source on GitHub ↗
(self, cell)

Source from the content-addressed store, hash-verified

232 self.dialog.show(self)
233
234 def fill_void_cells(self, cell):
235 checked_cells = [cell, ]
236 while len(checked_cells) > 0:
237 for cell in checked_cells[:]:
238 checked_cells.remove(cell)
239 if (not self.mine_matrix[cell.y][cell.x].has_mine) and \
240 (self.mine_matrix[cell.y][cell.x].nearest_mine == 0):
241 for coord in [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]:
242 _x, _y = coord
243 if not self.coord_in_map(cell.x + _x, cell.y + _y):
244 continue
245
246 if not self.mine_matrix[cell.y + _y][cell.x + _x].opened:
247 self.mine_matrix[cell.y + _y][cell.x + _x].check_mine(None, False)
248 checked_cells.append(self.mine_matrix[cell.y + _y][cell.x + _x])
249
250 def explosion(self, cell):
251 print("explosion")

Callers 1

no_mineMethod · 0.95

Calls 3

coord_in_mapMethod · 0.95
check_mineMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected