From db044959e3aeac9e755f0e466f78a5ef8977cbec Mon Sep 17 00:00:00 2001 From: Joshua Seigler Date: Thu, 3 Dec 2020 22:58:14 -0500 Subject: [PATCH] Remove newlines for twitter compatibility, tighten day 3 --- day02.js | 3 +-- day03.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/day02.js b/day02.js index 3c47919..3af5049 100644 --- a/day02.js +++ b/day02.js @@ -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)]; \ No newline at end of file +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)]; \ No newline at end of file diff --git a/day03.js b/day03.js index 95ca691..d0649d6 100644 --- a/day03.js +++ b/day03.js @@ -1,2 +1 @@ -let d=document.body.textContent.trim().split(` -`);let t=(X,Y)=>{let c=0;for(let y=0,x=0;yd.filter((l,i)=>(d[i*Y]||'')[i*X%l.length]=='#').length;[t(3),t(1)*t(3)*t(5)*t(7)*t(1,2)]; \ No newline at end of file