Пример #1
0
import robot
r = robot.rmap()
r.lm('task6')

def task():
    x = int(input("Enter letter width: "))
    y = int(input("Enter letter height: "))
    if x > 24 or y > 24 or x == 2:
        print("Error")
    else:
        if x-2*(x//2)<1:
            r.paint()
            r.down()
            r.paint()
            for w in range(x//2-1):
                r.right()
                r.paint()
            for h in range(y-2):
                r.down()
                r.paint()
            r.right()
            r.paint()
            for h in range(y-2):
                r.up()
                r.paint()
            for w in range(x//2-1):
                r.right()
                r.paint()
            r.up()
            r.paint()
            for x in range(x-1):
Пример #2
0
import robot
r = robot.rmap()
r.lm('task5')


def can_move_hor(rb, d):
    if d == 1:
        return not rb.wr()
    elif d == -1:
        return not rb.wl()

    return False


def move_hor(rb, d):
        if d == 1:
            rb.rt()
        elif d == -1:
            rb.lt()


def paint_row(rb, period, rem, d):
    col = 0
    while True:
        if col % period == rem:
            rb.pt('red')

        if can_move_hor(rb, d):
            move_hor(rb, d)
        else:
            break