Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
834 B
1
Indexable
Never
white = (255, 255, 255)
black = (0, 0, 0)

def make_array(w, h):
    return [[white for x in range(w)]for y in range(h)]


def fill_sprite(sprite):
    w = len(sprite[0])
    h = len(sprite)
    for a in range(h):
        for b in range(w // 2 + 1):
            sprite[a][b] = random.choice([black, white])
            sprite[a][w-b-1] = sprite[a][b]
    
    
def mirror_sprite(sprite):
    w = len(sprite[0])
    h = len(sprite)
    for a in range(h):
        for b in range(w // 2 + 1):
            sprite[a][-b-1] = sprite[a][b]
    
screen = [[white for x in range(500)] for y in range(500)]
plt.imshow(screen)
    
    
def make_sprite(w,h):
    sprite = make_array(10,10)
    fill_sprite(sprite)
    mirror_sprite(sprite)
    return sprite

sprite = make_sprite(50,50)
plt.imshow(screen)