W,H,r=40,13,range;g=[' ']*H*W
C=[7,16,12,21,5,14,11,20,7,16,12,21,3,11,10,18]
for i in r(8):
for z in[3*exp(2j*pi*t/12)for t in r(*C[2*i:2*i+2])]:
g[(round(z.real)+3+i//2*11)+W*(int(z.imag)+3+i%2*6)]='2025'[i//2]
[print(*g[y*W:][:W],sep='')for y in r(H)];print()
W,H,r=40,13,range;g=[' ']*H*W
C=[7,16,12,21,5,14,11,20,7,16,12,21,3,11,10,18]
for i in r(8):
for z in[3*exp(2j*pi*t/12)for t in r(*C[2*i:2*i+2])]:
g[(round(z.real)+3+i//2*11)+W*(int(z.imag)+3+i%2*6)]='2025'[i//2]
[print(*g[y*W:][:W],sep='')for y in r(H)];print()
W,H,r=40,13,range;g=[' ']*H*W
C=[7,16,12,21,5,14,11,20,7,16,12,21,3,11,10,18]
for i in r(8):
for z in[3*exp(2j*pi*t/12)for t in r(*C[2*i:2*i+2])]:
g[(round(z.real)+3+i//2*11)+W*(int(z.imag)+3+i%2*6)]='2025'[i//2]
[print(*g[y*W:][:W],sep='')for y in r(H)];print()
Part 2 unfortunately had to brute force, will see if I can find the better solution
Part 2 unfortunately had to brute force, will see if I can find the better solution
Nicely sets me up for another pkitslaar.github.io/PyChristmasT... idea
Nicely sets me up for another pkitslaar.github.io/PyChristmasT... idea
Took a bit longer since I did not wanted to use something like NetworkX but wanted to code my own graph search (again)
Took a bit longer since I did not wanted to use something like NetworkX but wanted to code my own graph search (again)
Again Part2 was brute-forced (total time 80 seconds).
Will try to speed up.
Again Part2 was brute-forced (total time 80 seconds).
Will try to speed up.