示例#1
0
文件: hoard.py 项目: lzbrooks/gremlin
 def remove_row(self, row_index):
     """Removes row and respective column
     by removing cells at row_index row
     and removing cells at row_index column
     """
     row_column_indexes = MatrixMathUtils.get_column_indexes(row_index, self.hoard_row_size)
     [self.hoard.remove(i) for i in row_column_indexes]
     row_indexes = MatrixMathUtils.get_row_indexes(row_index, self.hoard_row_size)
     [self.hoard.remove(i) for i in row_indexes]
示例#2
0
文件: hoard.py 项目: lzbrooks/gremlin
 def add_row(self, row_string):
     """Add row and respective column
     by appending row string to end of hoard array
     and inserting 0s at hoard_row_size column index
     """
     new_row = BinaryFileUtils.string_to_bits(row_string)
     for cell in new_row:
         self.hoard.append(cell)
     hoard_column_indexes = MatrixMathUtils.get_column_indexes(self.hoard_row_size, self.hoard_row_size)
     [self.hoard.insert(i, 0) for i in hoard_column_indexes]
示例#3
0
文件: hoard.py 项目: lzbrooks/gremlin
 def remove_tags(self, row_index, tag_indexes):
     """Remove tags from row
     by setting row's tag indexes to 0s
     """
     cell_indexes = MatrixMathUtils.get_columns_in_row(row_index, tag_indexes, self.hoard_row_size)
     [self.hoard.insert(i, 0) for i in cell_indexes]
示例#4
0
文件: hoard.py 项目: lzbrooks/gremlin
 def add_tags(self, row_index, tag_indexes):
     """Add tags to row
     by setting row's tag indexes to 1s
     """
     cell_indexes = MatrixMathUtils.get_columns_in_row(row_index, tag_indexes, self.hoard_row_size)
     [self.hoard.insert(i, 1) for i in cell_indexes]
示例#5
0
文件: hoard.py 项目: lzbrooks/gremlin
 def get_riddled_row(self, hoard_row, riddle_column_indexes):
     riddled_row_indexes = MatrixMathUtils.get_columns_in_row(hoard_row, riddle_column_indexes, self.hoard_row_size)
     return [self.hoard[i] for i in riddled_row_indexes]
示例#6
0
文件: hoard.py 项目: lzbrooks/gremlin
 def get_column(self, hoard_column):
     hoard_column_indexes = MatrixMathUtils.get_column_indexes(hoard_column, self.hoard_row_size)
     return [self.hoard[i] for i in hoard_column_indexes]
示例#7
0
文件: hoard.py 项目: lzbrooks/gremlin
 def get_row(self, hoard_row):
     hoard_row_indexes = MatrixMathUtils.get_row_indexes(hoard_row, self.hoard_row_size)
     return [self.hoard[i] for i in hoard_row_indexes]
示例#8
0
文件: hoard.py 项目: lzbrooks/gremlin
 def get_cell(self, hoard_row, hoard_column):
     hoard_cell_index = MatrixMathUtils.get_cell_index(hoard_row, hoard_column, self.hoard_row_size)
     return self.hoard[hoard_cell_index]