Exemple #1
0
from drawings import preamble, postamble, draw_cropped_square, draw_tetromino

if __name__ == '__main__':
    preamble()
    draw_cropped_square(0, 2, 7)
    tetrominos = [
        (0.5, 2.5, 3), (1.5, 0.5, 2),
        (7.5, 1.5, 0), (7.5, 2.5, 2),
    ]
    for x, y, t in tetrominos:
        draw_tetromino(x, y, t)
    ghost_tetrominos = [
        (3.5, 1.5, 0), (5.5, 0.5, 2),
        (8.5, 4.5, 1), (7.5, 6.5, 3),
    ]
    for x, y, t in ghost_tetrominos:
        draw_tetromino(x, y, t, ['dashed'])
    postamble()
Exemple #2
0
from drawings import preamble, postamble, draw_cropped_square, draw_tetromino, draw_square

if __name__ == '__main__':
    preamble()
    draw_cropped_square(0, 0, 5)
    tetrominos = [(0.5, 3.5, 3), (2.5, 4.5, 0), (2.5, 1.5, 1), (3.5, 1.5, 3), (4.5, 3.5, 1)]
    for x, y, t in tetrominos:
        draw_tetromino(x, y, t)
    draw_square(1, 2, extras=['pattern = north east lines'])
    postamble()
Exemple #3
0
from drawings import preamble, postamble, draw_tetromino, draw_square

def draw_strip(height, length):
    i = 0
    parity = 0
    x = 1.5 
    while i < length:
        y = height + 1.5 - parity
        r = 2 * parity
        extras = ['dashed'] if 0 < i < 3 else []
        yield (x, y, r, extras)
        x = x + 2
        parity = 1 - parity
        i = i + 1
        
if __name__ == '__main__':
    preamble()
    strip1 = list(draw_strip(6, 4))
    strip2 = list(draw_strip(3, 4))
    strip3 = list(draw_strip(0, 5))
    tetrominos = strip1 + strip2 + strip3
    for x, y, t, extras in tetrominos:
        draw_tetromino(x, y, t, extras)
    squares = [(0, 0), (10, 0), (0, 3), (8, 4), (9, 3), (9, 4), (0, 6), (8, 7)] 
    for x, y in squares:
        draw_square(x, y, extras=['pattern = north east lines'])
    postamble()
Exemple #4
0
from drawings import preamble, postamble, draw_square, draw_tetromino

if __name__ == "__main__":
    preamble()

    single_squares = [(0, 0), (0, 1), (1, 0), (17, 17)]
    for (x, y) in single_squares:
        draw_square(x, y)

    tetrominos = [(2.5, 1.5, 0), (16.5, 0.5, 2), (17.5, 2.5, 1), (16.5, 16.5, 3)]
    for x, y, t in tetrominos:
        draw_tetromino(x, y, t)

    ghost_tetrominos = [
        (6.5, 1.5, 0),
        (4.5, 0.5, 2),
        (14.5, 1.5, 0),
        (12.5, 0.5, 2),
        (17.5, 6.5, 1),
        (16.5, 4.5, 3),
        (17.5, 14.5, 1),
        (16.5, 12.5, 3),
    ]
    for x, y, t in ghost_tetrominos:
        draw_tetromino(x, y, t, ["dashed"])

    draw_square(0, 2, 16, ["pattern = north east lines"])

    postamble()