MCPcopy Index your code
hub / github.com/ndleah/python-mini-project / dig

Method dig

Minesweeper_game/minesweeper.py:50–65  ·  view source on GitHub ↗
(self, row, col)

Source from the content-addressed store, hash-verified

48 return num_neighboring_bombs
49
50 def dig(self, row, col):
51 self.dug.add((row, col))
52
53 if self.board[row][col] == '*':
54 return False
55 elif self.board[row][col] > 0:
56 return True
57
58
59 for r in range(max(0, row-1), min(self.dim_size-1, row+1)+1):
60 for c in range(max(0, col-1), min(self.dim_size-1, col+1)+1):
61 if (r, c) in self.dug:
62 continue
63 self.dig(r, c)
64
65 return True
66
67 def __str__(self):
68 visible_board = [[None for _ in range(self.dim_size)] for _ in range(self.dim_size)]

Callers 1

playFunction · 0.95

Calls 1

addMethod · 0.45

Tested by

no test coverage detected