Last active
December 6, 2019 07:39
-
-
Save emplv/468bc5632284b61642ec78a4ff8b6ddc to your computer and use it in GitHub Desktop.
AoC 2019 - day 5
This file contains hidden or 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
| const INPUT = ` | |
| COPY & PASTE HERE | |
| `.trim``.split`,`; | |
| // part 1 | |
| (z=y=>([q,w,e,r]=t.slice(y),99-(u=q%100))?(t[[,r,r,w][u]]=[,(i=(b=q/100|0)&1?w:t[w])-+-(o=b&8?e:t[e]),i*o,x][u],z(y+2**2**(u<3))):+i)(0,x=1,t=[...INPUT]); | |
| // part 2 (also works for part1) | |
| (z=y=>([q,w,e,r]=t.slice(y),99-(u=q%100))?(t[[,r,r,w][u%6]]=[,(i=(b=q/100|0)&1?w:t[w])-+-(o=b&8?e:t[e]),i*o,x,,,,i<o,i==o][u],z(y+=u%7<3?4:u<5?2:u<6^!+i?+o-y:3)):i)(0,x=5,t=[...INPUT]); | |
| // | |
| x=5,t=[...fetchSync('http://ix.io/23CO').trim().split(',')]; | |
| // |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment