예제 #1
0
    def analyze(field, parser: InputParser, row_section, col_section):
        available = {1, 2, 3, 4, 5, 6, 7, 8, 9}
        scores = dict()
        for i, y in enumerate(field):
            row = parser.row(row_section + i)
            for j, x in enumerate(y):
                if x == 0:
                    col = parser.col(col_section + j)
                    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
예제 #2
0
    def analyze(field, parser: InputParser):
        available = {1, 2, 3, 4, 5, 6, 7, 8, 9}
        scores = dict()
        for i, y in enumerate(field):
            row = parser.row(i)
            for x in y:
                if x == 0:
                    col = parser.col(x, y.index(x))
                    scores[i, x] = (row | col)
                elif x in available:
                    available.remove(x)

        # ! ----------------------------------------

        for i, x in scores:
            scores[i, x] = available.difference(scores[i, x])

        return scores