r/adventofcode • u/daggerdragon • Dec 08 '17
SOLUTION MEGATHREAD -๐- 2017 Day 8 Solutions -๐-
--- Day 8: I Heard You Like Registers ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
Need a hint from the Hugely* Handyโ Haversackโก of Helpfulยง Hintsยค?
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
23
Upvotes
View all comments
1
u/COOLGAMETUBE Dec 08 '17
JavaScript // === Day 08 === // Copy the code into the // console of your input page let vm={}; vm.input=document.body.innerText; vm.data={}; vm.requiredAllocation=0; function getVal(x) {if(Number.isNaN(Number(x))) return ((vm.data[x]==null)?vm.data[x]=0:vm.data[x]); else return x;} for(let d of vm.input.split("\n")) if(d!="") { let c = d.split(" ");