Exemplo n.º 1
0
    def __init__(self):
        QWidget.__init__(self)
        RevealFields.__init__(
            self,
            path_to_icons_with_values=settings.
            SETTINGS_OF_FIELDS_WITH_VALUES["PATH_TO_ICONS"],
            file_format_of_icons_with_values=settings.
            SETTINGS_OF_FIELDS_WITH_VALUES["ICON_FILE_FORMAT"])
        self._main_horizontal_layout = QHBoxLayout(self)
        self._left_layout = QVBoxLayout()
        self._widget_of_left_layout = QWidget()
        self._right_layout = QVBoxLayout()
        self._widget_of_right_layout = QWidget()
        self._board_height = None
        self._board_width = None
        self._number_of_mines = None
        self._board_array = None
        self._score = 0
        self._score_label = None
        self._matrix_of_buttons = []
        self._number_of_reveal_fields = 0
        self._initial_widget_config()
        self.start_scene()

        self._seconds = 0
        self._minutes = 0
        self._hours = 0
        self._time_label = QLabel("00:00:00", self)
        self._time_label.setVisible(False)
        self._game_time = 0
        self._last_game_time_label = "00:00:00"
        self._timer = QtCore.QTimer()
        self._timer.timeout.connect(self._update_time_label)
        self._last_game_time = 0
Exemplo n.º 2
0
    def test_revealing_not_flagged(self):
        board = generate_board(10, 10, 10)

        rev = RevealFields(board, 5, 5)
        rev._reveal_neighbours(5, 5)

        self.assertEqual(board[5][5].flagged, False)
        self.assertEqual(board[5][5].revealed, False)
Exemplo n.º 3
0
 def test_pos_both_correct(self):
     board = generate_board(10, 10, 10)
     rev = RevealFields(board, 10, 10)
     self.assertEqual(rev._is_pos_correct(6, 7), True)
Exemplo n.º 4
0
 def test_pos_second_more(self):
     board = generate_board(37, 37, 10)
     rev = RevealFields(board, 37, 37)
     self.assertEqual(rev._is_pos_correct(9, 40), False)
Exemplo n.º 5
0
 def test_pos_first_more(self):
     board = generate_board(7, 21, 10)
     rev = RevealFields(board, 7, 21)
     self.assertEqual(rev._is_pos_correct(9, 15), False)
Exemplo n.º 6
0
 def test__pos_second_less(self):
     board = generate_board(7, 9, 10)
     rev = RevealFields(board, 7, 9)
     self.assertEqual(rev._is_pos_correct(-5, -9), False)
Exemplo n.º 7
0
 def test_pos_first_less(self):
     board = generate_board(6, 6, 10)
     rev = RevealFields(board, 6, 6)
     self.assertEqual(rev._is_pos_correct(-1, 3), False)