-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
62 lines (55 loc) · 5.23 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const fs = require("fs");
var day1 = require("./src/day1/day1");
var day2 = require("./src/day2/day2");
var day3 = require("./src/day3/day3");
var day4 = require("./src/day4/day4");
var day5 = require("./src/day5/day5");
var day6 = require("./src/day6/day6");
var day7 = require("./src/day7/day7");
/*
//day1
var day1Input = "6592822488931338589815525425236818285229555616392928433262436847386544514648645288129834834862363847542262953164877694234514375164927616649264122487182321437459646851966649732474925353281699895326824852555747127547527163197544539468632369858413232684269835288817735678173986264554586412678364433327621627496939956645283712453265255261565511586373551439198276373843771249563722914847255524452675842558622845416218195374459386785618255129831539984559644185369543662821311686162137672168266152494656448824719791398797359326412235723234585539515385352426579831251943911197862994974133738196775618715739412713224837531544346114877971977411275354168752719858889347588136787894798476123335894514342411742111135337286449968879251481449757294167363867119927811513529711239534914119292833111624483472466781475951494348516125474142532923858941279569675445694654355314925386833175795464912974865287564866767924677333599828829875283753669783176288899797691713766199641716546284841387455733132519649365113182432238477673375234793394595435816924453585513973119548841577126141962776649294322189695375451743747581241922657947182232454611837512564776273929815169367899818698892234618847815155578736875295629917247977658723868641411493551796998791839776335793682643551875947346347344695869874564432566956882395424267187552799458352121248147371938943799995158617871393289534789214852747976587432857675156884837634687257363975437535621197887877326295229195663235129213398178282549432599455965759999159247295857366485345759516622427833518837458236123723353817444545271644684925297477149298484753858863551357266259935298184325926848958828192317538375317946457985874965434486829387647425222952585293626473351211161684297351932771462665621764392833122236577353669215833721772482863775629244619639234636853267934895783891823877845198326665728659328729472456175285229681244974389248235457688922179237895954959228638193933854787917647154837695422429184757725387589969781672596568421191236374563718951738499591454571728641951699981615249635314789251239677393251756396";
console.log(day1.normal(day1Input));
console.log(day1.halfway(day1Input));
//day2
var day2Input = "116\t1259\t1045\t679\t1334\t157\t277\t1217\t218\t641\t1089\t136\t247\t1195\t239\t834\n269\t1751\t732\t3016\t260\t6440\t5773\t4677\t306\t230\t6928\t7182\t231\t2942\t2738\t3617\n644\t128\t89\t361\t530\t97\t35\t604\t535\t297\t599\t121\t567\t106\t114\t480\n105\t408\t120\t363\t430\t102\t137\t283\t123\t258\t19\t101\t181\t477\t463\t279\n873\t116\t840\t105\t285\t238\t540\t22\t117\t125\t699\t953\t920\t106\t113\t259\n3695\t161\t186\t2188\t3611\t2802\t157\t2154\t3394\t145\t2725\t1327\t3741\t2493\t3607\t4041\n140\t1401\t110\t119\t112\t1586\t125\t937\t1469\t1015\t879\t1798\t122\t1151\t100\t926\n2401\t191\t219\t607\t267\t2362\t932\t2283\t889\t2567\t2171\t2409\t1078\t2247\t2441\t245\n928\t1142\t957\t1155\t922\t1039\t452\t285\t467\t305\t506\t221\t281\t59\t667\t232\n3882\t1698\t170\t5796\t2557\t173\t1228\t4630\t174\t3508\t5629\t4395\t180\t5100\t2814\t2247\n396\t311\t223\t227\t340\t313\t355\t469\t229\t162\t107\t76\t363\t132\t453\t161\n627\t1331\t1143\t1572\t966\t388\t198\t2068\t201\t239\t176\t1805\t1506\t1890\t1980\t1887\n3390\t5336\t1730\t4072\t5342\t216\t3823\t85\t5408\t5774\t247\t5308\t232\t256\t5214\t787\n176\t1694\t1787\t1586\t3798\t4243\t157\t4224\t3603\t2121\t3733\t851\t2493\t4136\t148\t153\n2432\t4030\t3397\t4032\t3952\t2727\t157\t3284\t3450\t3229\t4169\t3471\t4255\t155\t127\t186\n919\t615\t335\t816\t138\t97\t881\t790\t855\t89\t451\t789\t423\t108\t95\t116";
var day2TestInput = "5\t1\t9\t5\n7\t5\t3\n2\t4\t6\t8";
var day2TestInput2 = "5\t9\t2\t8\n9\t4\t7\t3\n3\t8\t6\t5";
console.log(day2.normal(day2TestInput));
console.log(day2.normal(day2Input));
console.log(day2.evenly(day2TestInput2));
console.log(day2.evenly(day2Input));
//day3
var day3Input = 325489;
var day3TestInput = 12;
console.log(day3.normal(day3TestInput));
console.log(day3.normal(day3Input));
//day4
var day4Input = fs.readFileSync("./src/day4/input.txt", "utf-8");
var day4TestInput = "abcde xyz ecdab";
console.log(day4.normal(day4TestInput));
console.log(day4.normal(day4Input));
console.log(day4.anagram(day4TestInput));
console.log(day4.anagram(day4Input));
//day5
var day5Input = fs.readFileSync("./src/day5/input.txt", "utf-8");
var day5TestInput = "0,3,0,1,-3";
console.log(day5.normal(day5TestInput));
console.log(day5.normal(day5Input));
console.log(day5.normal(day5TestInput, true));
console.log(day5.normal(day5Input, true));
//day6
var day6Input = [10, 3, 15, 10, 5, 15, 5, 15, 9, 2, 5, 8, 5, 2, 3, 6];
var day6TestInput = [0, 2, 7, 0];
console.log(day6.normal(day6TestInput));
console.log(day6.normal(day6Input));
console.log(day6.normal(day6TestInput, true));
console.log(day6.normal(day6Input, true));
*/
//day7
var day7Input = fs.readFileSync("./src/day7/input.txt", "utf-8");
var day7TestInput = fs.readFileSync("./src/day7/testinput.txt", "utf-8");
console.log(day7.findRoot(day7TestInput));
console.log(day7.findRoot(day7Input));
day7.weight(day7TestInput);
day7.weight(day7Input);