Skip to content

Instantly share code, notes, and snippets.

@lwhjp
Created December 15, 2023 10:41
Show Gist options
  • Save lwhjp/32b6513f4accb3cc3d1264858b8ee1b7 to your computer and use it in GitHub Desktop.
Save lwhjp/32b6513f4accb3cc3d1264858b8ee1b7 to your computer and use it in GitHub Desktop.
AoC 2023 day 09 (part 1) in Javascript
var a=(...x)=>e(x[1])?eval("a("+b(x,...x)):x[0],b=(_,...x)=>e(x[1]
)?x[1]+`- ${x[0]},`+b(...x): `)+`+x[0],c=x=>"eval('"+"^+a(/\n)/ ,"
.split(/\//).reduce((x,y)=>x.replaceAll(RegExp(y[0],"mg"),y.slice(
1)),x.trim()+")')"),d=x=> eval(c(f.readFileSync(x).toString())),e=
x=>x!=undefined,f=require('node:fs');console.log(d("input09.txt"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment