This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| x=452, y=1077..1087 | |
| y=782, x=505..509 | |
| y=1206, x=450..457 | |
| x=443, y=1708..1719 | |
| x=552, y=462..466 | |
| x=437, y=954..966 | |
| x=439, y=973..986 | |
| x=549, y=1138..1154 | |
| x=409, y=1096..1110 | |
| y=342, x=421..438 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs'); | |
| const [SAND, CLAY, REST, FLOW] = [1, 2, 3, 4]; | |
| let clay = []; | |
| const bounds = { | |
| x: Infinity, | |
| X: -Infinity, | |
| y: Infinity, | |
| Y: -Infinity | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <fstream> | |
| #include <iostream> | |
| #include <vector> | |
| bool isIn(int x, std::vector<int> xs) | |
| { | |
| int size = (int)xs.size(); | |
| for(int i = 0; i < size; ++i) { | |
| if(x == xs[i]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <fstream> | |
| #include <iostream> | |
| #include <vector> | |
| bool isIn(const int& x, const std::vector<int>& xs) | |
| { | |
| int size = (int)xs.size(); | |
| for(int i = 0; i < size; ++i) { | |
| if(x == xs[i]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs'); | |
| const [DEATH, LIFE, VOID] = [1, 2, 3]; | |
| const board = fs.readFileSync('aoc-input-18', 'utf-8') | |
| .trim() | |
| .split('\n') | |
| .map(line => line.split('') | |
| .map(c => | |
| c === '|' ? LIFE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <fstream> | |
| #include <iostream> | |
| #include <map> | |
| #include <string> | |
| int main() { | |
| int twos = 0; | |
| int threes = 0; | |
| std::string line; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // C ← op(A, B) | |
| let beforeIp; | |
| let ip = 0; | |
| let ipReg; | |
| const regs = [1, 0, 0, 0, 0, 0]; | |
| const instructions = { | |
| setIp: (value, regs) => { beforeIp = regs[value]; ipReg = value; regs[value] = ip; }, | |
| seti: ([a,b,c], r) => r[c] = a, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs'); | |
| const dirs = { | |
| E: { x: 1, y: 0 }, | |
| W: { x: -1, y: 0 }, | |
| S: { x: 0, y: 1 }, | |
| N: { x: 0, y: -1 } | |
| }; | |
| const inputs = { | |
| test1: "^ESSWWN(E|NNENN(EESS(WNSE|)SSS|WWWSSSSE(SW|NNNE)))$", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const c1 = 15466939; | |
| const c2 = 65899; | |
| //const s = 5285447;15615244; | |
| const nums = []; | |
| const dupes = []; | |
| let [r1, r2, r3, r4, r5] = [0, 0, 0, 0, 0]; | |
| let hits = 0; | |
| L6: while(true) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs'); | |
| const inputs = { | |
| test1: | |
| ` | |
| 1,-1,-1,-2 | |
| -2,-2,0,1 | |
| 0,2,1,3 | |
| -2,3,-2,1 | |
| 0,2,3,-2 |