Пример #1
0
def rule_quadrant_col_and_row_elim_possible(board: Board) -> List[Action]:

    action_arr = []

    max_val = board.max_val()
    max_sqrt = board.max_sqrt()

    for quadrant_x in range(0, max_val, max_sqrt):

        for quadrant_y in range(0, max_val, max_sqrt):

            quadrant_cells = board.quadrant_cells(quadrant_x, quadrant_y, True)
            if len(quadrant_cells) == 0:
                continue

            for col_y in range(quadrant_y, quadrant_y + max_sqrt):
                col_cells = board.col_cells(col_y, True)
                if len(col_cells) == 0:
                    continue

                action_arr.extend(_quadrant_col_cell_elim_helper(quadrant_cells, col_cells))

            for row_x in range(quadrant_x, quadrant_x + max_sqrt):
                row_cells = board.row_cells(row_x, True)
                if len(row_cells) == 0:
                    continue

                action_arr.extend(_quadrant_col_cell_elim_helper(quadrant_cells, row_cells))

    return action_arr
Пример #2
0
def combination_exclusive_quadrant_rule(board: Board) -> List[Action]:

    action_arr = []

    max_val =  board.max_val()
    max_sqrt = board.max_sqrt()

    for quadrant_x in range(0, max_val, max_sqrt):
        for quadrant_y in range(0, max_val, max_sqrt):
            quadrant_cells = board.quadrant_cells(quadrant_x, quadrant_y, True)

            action_arr.extend(_combination_exclusive_rule_helper(quadrant_cells))

    return action_arr