Remove newlines for twitter compatibility, tighten day 3

This commit is contained in:
Joshua Seigler 2020-12-03 22:58:14 -05:00
parent 46ae00bccc
commit db044959e3
2 changed files with 2 additions and 4 deletions

View file

@ -1,2 +1 @@
let d=document.body.textContent.trim().split(`
`).map(l=>l.match(/(.+)-(.+) (.): (.+)$/));[d.reduce((s,[_,l,u,n,h])=>{const c=[...h.matchAll(RegExp(n,'g'))].length;return c<=u&&c>=l?s+1:s},0),d.reduce((s,[_,a,b,n,h])=>{return h[a-1]==n^h[b-1]==n?s+1:s},0)];
let d=document.body.textContent.trim().split('\n').map(l=>l.match(/(.+)-(.+) (.): (.+)$/));[d.reduce((s,[_,l,u,n,h])=>{const c=[...h.matchAll(RegExp(n,'g'))].length;return c<=u&&c>=l?s+1:s},0),d.reduce((s,[_,a,b,n,h])=>{return h[a-1]==n^h[b-1]==n?s+1:s},0)];

View file

@ -1,2 +1 @@
let d=document.body.textContent.trim().split(`
`);let t=(X,Y)=>{let c=0;for(let y=0,x=0;y<d.length;){c+=d[y][x%d[0].length]=='#'?1:0;x+=X;y+=Y}return c};[t(3,1),t(1,1)*t(3,1)*t(5,1)*t(7,1)*t(1,2)];
let d=document.body.textContent.trim().split('\n');let t=(X,Y=1)=>d.filter((l,i)=>(d[i*Y]||'')[i*X%l.length]=='#').length;[t(3),t(1)*t(3)*t(5)*t(7)*t(1,2)];