Created
December 8, 2016 05:54
-
-
Save blockingthesky/c8a74a7763bf1e4c8b22fed6ab6c0e93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gen_screen = (True, 50, 6) | |
inp = [] | |
if gen_screen[0]: | |
import random | |
inp = [''.join([random.choice(list('#..')) for i in range(gen_screen[1])]) for j in range(gen_screen[2])] | |
else: | |
inp = open('screen.in').read().split('\n') | |
screen = [[y == '#' for y in row] for row in inp] | |
W, H = (len(screen[0]), len(screen)) | |
def pscreen(): | |
print '\n'.join(''.join('#' if a else '.' for a in row) for row in screen) | |
print sum(sum(screen, [])) | |
pscreen() | |
cmds = [] | |
for row in reversed(screen): | |
for i in range(W): | |
cmds.append("rotate column x=" + str(i) + " by 1") | |
for blip in reversed(row): | |
cmds.append("rotate row y=0 by 1") | |
if blip: | |
cmds.append("rect 1x1") | |
out = open('cmds.out', 'w').write('\n'.join(cmds)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment