You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
809 B
36 lines
809 B
with open('input10.txt','r') as f: |
|
inp = f.read().splitlines(keepends=False) |
|
|
|
line = 0 |
|
register = 1 |
|
picture = [] |
|
executing = 0 |
|
pending = 0 |
|
|
|
for _ in range(6): |
|
curline = [] |
|
for i in range(40): |
|
if executing == 0: |
|
register += pending |
|
pending = 0 |
|
ins = inp[line] |
|
line += 1 |
|
if 'noop' in ins: |
|
executing = 1 |
|
elif 'addx' in ins: |
|
tempa, tempb = ins.split(' ') |
|
pending = int(tempb) |
|
executing = 2 |
|
|
|
if i in [register - 1, register, register + 1]: |
|
curline.append('#') |
|
else: |
|
curline.append('.') |
|
executing -= 1 |
|
picture.append(curline) |
|
|
|
for i in picture: |
|
row = '' |
|
for j in i: |
|
row += j |
|
print(row)
|
|
|