scores[i, j] = (row | col) elif x in available: available.remove(x) # ! ---------------------------------------- for i, x in scores: scores[i, x] = available.difference(scores[i, x]) return scores @staticmethod def recursive_fill_fields(scores, sudoku): pass @staticmethod def fill_cell(row, col, n, scores, sudoku: list): sudoku[row][col] = n return scores[row, col].remove(n) parser_obj = InputParser('test1') ret = parser_obj.get_input() matrix = parser_obj.get_square(3, 0) # return generator # for i in matrix: # print(i) scores = SudokuAnalyzer.analyze(matrix, parser_obj, 3, 0) pprint(scores) # SudokuAnalyzer.recursive_fill_fields(scores, ret)
available.remove(x) # ! ---------------------------------------- for i, x in scores: scores[i, x] = available.difference(scores[i, x]) return scores @staticmethod def recursive_fill_fields(scores): pass @staticmethod def fill_cell(cell_row, cell_col, field_row, field_col, n, sudoku: list): sudoku[cell_row][cell_col][field_row][field_col] = n parser_obj = InputParser('../test1') parser_obj.cell_length = 3 parser_obj.side_length = 3 # analyzer = SudokuAnalyzer() ret = parser_obj.get_input() # print(*ret, sep='\n') matrix = parser_obj.get_square(0, 0) ret2 = SudokuAnalyzer.analyze(matrix, parser_obj) # SudokuAnalyzer.fill_cell(0, 0, 0, 0, 4, ret) # print(sud) print(ret2)