this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Day 7 part 2

+22 -4
+15 -3
index.js
··· 15 15 16 16 // TODO: Go back and redo days 2 & 3, for consistency :) 17 17 18 - /* 18 + /** 19 19 * Day 4! 20 20 * ---------------------------------- 21 21 */ ··· 28 28 console.log('Day 4, Part 1:', day4Part1Answer); 29 29 console.log('Day 4, Part 2:', day4Part2Answer); 30 30 31 - /* 31 + /** 32 32 * Day 5! 33 33 * ---------------------------------- 34 34 */ ··· 78 78 Day7.processInstruction(instruction); 79 79 }); 80 80 81 - console.log('Day 7, Part 1:', Day7.getWireSignal('a')); 81 + var signalA = Day7.getWireSignal('a'); 82 + console.log('Day 7, Part 1:', signalA); 83 + 84 + Day7.resetWires(); 85 + 86 + day7Input.split('\n').forEach(function(instruction) { 87 + Day7.processInstruction(instruction); 88 + }); 89 + 90 + Day7.setSignal('b', signalA); 91 + 92 + var newSignalA = Day7.getWireSignal('a'); 93 + console.log('Day 7, Part 2:', newSignalA);
+7 -1
lib/day7.js
··· 55 55 return wires[wire](); 56 56 }, 57 57 58 - resetWires: function() { wires = {} } 58 + setSignal: function(wire, signal) { 59 + wires[wire] = function() { return signal }; 60 + }, 61 + 62 + resetWires: function() { 63 + wires = {}; 64 + } 59 65 60 66 }; 61 67