mirror of
https://github.com/seigler/advent-of-code-browser-console
synced 2025-07-26 00:06:10 +00:00
Day 8
This commit is contained in:
parent
db2b9215aa
commit
23db4666a9
1 changed files with 1 additions and 0 deletions
1
day08.js
Normal file
1
day08.js
Normal file
|
@ -0,0 +1 @@
|
|||
L=$`body`.innerText.trim().split`\n`.map(b=>/(.).+ (.+)/.exec(b).slice(1)),X=b=>{for(p=a=0,v=[],O={n:()=>p++,a:b=>{a+=b,p++},j:b=>p+=b};p<b.length;){if(v.includes(p))return[a,0];v.push(p);let[c,d]=b[p];O[c](1*d)}return[a,1]},M=b=>{S=[],b.forEach(([c,d],e)=>{/n|j/.test(c)&&(s=b.slice(),s[e]=["m"<c?"j":"n",d],S.push(s))});for(let c of S)if(result=X(c),result[1])return result},[X(L)[0],M(L)[0]];
|
Loading…
Add table
Add a link
Reference in a new issue