Beispiel #1
0
 def _build_column_groups(self):
     """Add a group for each column"""
     for col_index in range(9):
         col_group = Group("Column {}".format(col_index))
         for row_index in range(9):
             col_group.add(self.tiles[row_index][col_index])
         self.groups.append(col_group)
Beispiel #2
0
 def _build_row_groups(self):
     """Add a group for each row"""
     for row_index in range(9):
         row_group = Group("Row {}".format(row_index + 1))
         for tile in self.tiles[row_index]:
             row_group.add(tile)
         self.groups.append(row_group)
Beispiel #3
0
 def _build_block_groups(self):
     """Add a group for each 3x3 block"""
     for row_group in range(0, 9, 3):
         for col_group in range(0, 9, 3):
             block_group = Group("Block from {},{}".format(
                 row_group, col_group))
             for row in range(3):
                 for col in range(3):
                     row_offset = row_group + row
                     col_offset = col_group + col
                     block_group.add(self.tiles[row_offset][col_offset])
             self.groups.append(block_group)
Beispiel #4
0
 def _build_block_groups(self):
     """Add a group for each 3x3 block"""
     for row in range(3):
         for col in range(3):
             block_group = Group("Block from {},{}".format(row, col))
             row1 = 3 * row
             col1 = 3 * col
             for row2 in range(3):
                 for col2 in range(3):
                     tile_row = row1 + row2
                     tile_col = col1 + col2
                     block_group.add(self.tiles[tile_row][tile_col])
             self.groups.append(block_group)
Beispiel #5
0
 def _build_block_groups(self):
     """Add a group for each 3x3 block"""
     for row_group in range(3):
         for col_group in range(3):
             block_group = Group("Block from {},{}"
                                 .format(row_group, col_group))
             row_base = 3 * row_group
             col_base = 3 * col_group
             for row_offset in range(3):
                 for col_offset in range(3):
                     tile_row = row_base + row_offset
                     tile_col = col_base + col_offset
                     block_group.add(self.tiles[tile_row][tile_col])
             self.groups.append(block_group)