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

Method check_if_win

examples/minefield_app.py:214–232  ·  view source on GitHub ↗

Here are counted the flags. Is checked if the user win.

(self)

Source from the content-addressed store, hash-verified

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, ]

Callers 2

new_gameMethod · 0.95
on_right_clickMethod · 0.80

Calls 3

set_textMethod · 0.45
doMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected