Ejemplo n.º 1
0
def instructions_from_file(file_path: str):
    row_instructions_as_int, column_instructions_as_int = [], []
    with open(file_path) as fh:
        do_row = True
        for i, line in enumerate(fh):
            if do_row:
                if 'COL' in line:
                    do_row = False
                    continue
                row_instructions_as_int.append(line_to_arr(line))
            else:
                column_instructions_as_int.append(line_to_arr(line))
    row_instructions = []
    column_instructions = []
    for row in row_instructions_as_int:
        row_instructions.append(RowInstructions.from_list(row))
    for column in column_instructions_as_int:
        column_instructions.append(RowInstructions.from_list(column))
    return row_instructions, column_instructions
Ejemplo n.º 2
0
def data():
    return {
        EMPTY_ROW:
        CellRow.from_bool([None for i in range(5)]),
        FALSE_MIDDLE_ROW:
        CellRow.from_bool([None, None, False, None, None]),
        FALSE_MID_RIGHT_ROW:
        CellRow.from_bool([None, None, None, False, None]),
        FALSE_MID_LEFT_ROW:
        CellRow.from_bool([None, False, False, None, None]),
        TRUE_RIGHT_ROW:
        CellRow.from_bool([None, None, None, None, True]),
        TURE_RIGHT_FALSE_RIGHT_ROW:
        CellRow.from_bool([None, None, None, False, True]),
        FULL_ROW:
        CellRow.from_bool([True, True, True, True, True]),
        TRUE_FALSE_ALT_ROW:
        CellRow.from_bool([True, False, True, False, True]),
        TURE_MID_FALSE_MID_LEFT_ROW:
        CellRow.from_bool([None, False, True, None, None]),
        MUTUAL_TRUE_ROW:
        CellRow.from_bool([
            None, None, None, None, None, None, True, False, None, None, None
        ]),
        MUTUAL_TRUE_REVERSE_ROW:
        CellRow.from_bool([
            None, None, None, False, True, None, None, None, None, None, None
        ]),
        SINGLE_ONE_INS:
        RowInstructions.from_list([1]),
        TWO_ONE_INS:
        RowInstructions.from_list([1, 1]),
        THREE_ONE_INS:
        RowInstructions.from_list([1, 1, 1]),
        FOUR_ONE_INS:
        RowInstructions.from_list([1, 1, 1, 1]),
        ONE_TWO_INS:
        RowInstructions.from_list([1, 2]),
        TWO_THREE_INS:
        RowInstructions.from_list([2, 3]),
        THREE_TWO_INS:
        RowInstructions.from_list([3, 2]),
        FULL_INS:
        RowInstructions.from_list([5]),
        THREE_INS:
        RowInstructions.from_list([3]),
    }