Exemplo n.º 1
0
def algorithm(picture, args):
    """
    Keep placing the biggest square possible. When only squares of size 1 are
    possible, fill with lines.
    """
    painter = Painter(picture.empty_copy())

    square = Square(-1, -1, 100000)
    while True:
        square = get_largest_unpainted_square(picture, painter, square.size)
        if not square:
            break
        painter.paint_square(square.row, square.column, square.size)

    for row, column in painter.picture.positions_to_paint(picture):
        if painter.picture[row][column]:
            continue

        length = 0

        for i in range(row + 1, picture.shape[0]):
            if picture[i][column]:
                length += 1
            else:
                break

        painter.paint_line(row, column, row + length, column)

    return painter
Exemplo n.º 2
0
def algorithm(picture, args):
    """
    Paint each cell with a single command resulting in a score 0
    """
    painter = Painter(picture.empty_copy())

    for row, column in painter.picture.positions_to_paint(picture):
        painter.paint_square(row, column, 0)

    return painter
Exemplo n.º 3
0
def algorithm(picture, args):
    """
    Keep placing the biggest square possible
    """
    painter = Painter(picture.empty_copy())

    square = Square(-1, -1, 100000)
    while True:
        square = get_largest_unpainted_square(picture, painter, square.size)
        if not square:
            break
        painter.paint_square(square.row, square.column, square.size)

    return painter