Skip to content

Instantly share code, notes, and snippets.

@emplv
Created December 11, 2019 12:41
Show Gist options
  • Select an option

  • Save emplv/b6a0183f109af3ef40c0dc08f61f21e8 to your computer and use it in GitHub Desktop.

Select an option

Save emplv/b6a0183f109af3ef40c0dc08f61f21e8 to your computer and use it in GitHub Desktop.
AoC 2019 - day 10
d=(I=``.trim().split`\n`)[0].length;
// part 1
Math.max(I.flatMap(x=>x.split``).map((x,i,a)=>x=='#'?a.map((y,j)=>i!=j&&x==y?Math.atan2(j%d-i%d,(j/d|0)-(i/d|0)):NaN).filter((z,k,b)=>1/z&&b.findIndex(q=>q==z)==k).length:0))
// part 2
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment