Here are counted the flags. Is checked if the user win.
(self)
| 212 | self.fill_void_cells(cell) |
| 213 | |
| 214 | def check_if_win(self): |
| 215 | """Here are counted the flags. Is checked if the user win.""" |
| 216 | self.flagcount = 0 |
| 217 | win = True |
| 218 | for x in range(0, len(self.mine_matrix[0])): |
| 219 | for y in range(0, len(self.mine_matrix)): |
| 220 | if self.mine_matrix[y][x].state == 1: |
| 221 | self.flagcount += 1 |
| 222 | if not self.mine_matrix[y][x].has_mine: |
| 223 | win = False |
| 224 | elif self.mine_matrix[y][x].has_mine: |
| 225 | win = False |
| 226 | self.lblMineCount.set_text("%s" % self.minecount) |
| 227 | self.lblFlagCount.set_text("%s" % self.flagcount) |
| 228 | if win: |
| 229 | self.dialog = gui.GenericDialog(title='You Win!', message='Game done in %s seconds' % self.time_count) |
| 230 | self.dialog.confirm_dialog.do(self.new_game) |
| 231 | self.dialog.cancel_dialog.do(self.new_game) |
| 232 | self.dialog.show(self) |
| 233 | |
| 234 | def fill_void_cells(self, cell): |
| 235 | checked_cells = [cell, ] |
no test coverage detected