From 483478034725aa29b42daaf876b93af4f7b4f89a Mon Sep 17 00:00:00 2001 From: Andrew Coleman Date: Wed, 16 Jan 2019 22:25:09 -0500 Subject: [PATCH] starting day17 solution --- 2018/day17/Cargo.lock | 4 + 2018/day17/Cargo.toml | 7 + 2018/day17/input | 1527 ++++++++++++++++++++++++++++++++++++++++ 2018/day17/src/main.rs | 55 ++ 2018/day17/test-input | 8 + 5 files changed, 1601 insertions(+) create mode 100644 2018/day17/Cargo.lock create mode 100644 2018/day17/Cargo.toml create mode 100644 2018/day17/input create mode 100644 2018/day17/src/main.rs create mode 100644 2018/day17/test-input diff --git a/2018/day17/Cargo.lock b/2018/day17/Cargo.lock new file mode 100644 index 0000000..b3efdf4 --- /dev/null +++ b/2018/day17/Cargo.lock @@ -0,0 +1,4 @@ +[[package]] +name = "day17" +version = "0.1.0" + diff --git a/2018/day17/Cargo.toml b/2018/day17/Cargo.toml new file mode 100644 index 0000000..46deb28 --- /dev/null +++ b/2018/day17/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "day17" +version = "0.1.0" +authors = ["Andrew Coleman "] +edition = "2018" + +[dependencies] diff --git a/2018/day17/input b/2018/day17/input new file mode 100644 index 0000000..1503d99 --- /dev/null +++ b/2018/day17/input @@ -0,0 +1,1527 @@ +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 +y=1394, x=428..430 +x=540, y=382..398 +y=43, x=480..504 +y=1353, x=430..445 +x=547, y=157..168 +y=397, x=387..390 +x=396, y=1251..1275 +x=488, y=1003..1018 +y=349, x=457..477 +y=495, x=435..456 +x=503, y=739..752 +y=1392, x=476..478 +x=450, y=196..224 +x=526, y=702..712 +x=579, y=731..734 +x=438, y=1562..1578 +y=352, x=499..516 +x=577, y=1388..1410 +x=477, y=1215..1225 +y=82, x=485..487 +x=493, y=465..476 +y=377, x=422..429 +x=483, y=763..776 +x=575, y=1501..1529 +y=1548, x=388..390 +x=459, y=1115..1116 +x=581, y=276..294 +x=433, y=1153..1162 +x=420, y=1384..1397 +x=418, y=1332..1353 +x=513, y=706..720 +y=1125, x=424..443 +x=429, y=1093..1104 +y=1326, x=521..526 +x=475, y=1043..1064 +x=422, y=1671..1678 +x=403, y=1303..1309 +y=687, x=426..429 +x=543, y=114..126 +x=544, y=1484..1486 +x=568, y=876..895 +x=374, y=793..797 +x=495, y=1195..1204 +x=506, y=307..313 +x=469, y=237..247 +x=486, y=1365..1377 +x=453, y=1038..1058 +y=758, x=411..429 +x=535, y=700..709 +x=496, y=443..457 +y=29, x=418..429 +y=86, x=485..487 +x=442, y=1198..1209 +x=550, y=1097..1114 +x=481, y=1426..1436 +y=583, x=569..581 +x=387, y=982..1010 +x=398, y=658..667 +x=468, y=137..153 +x=454, y=745..756 +y=1104, x=504..508 +x=438, y=327..342 +x=383, y=1365..1367 +x=445, y=658..663 +y=366, x=446..448 +y=1292, x=375..400 +x=528, y=1177..1203 +x=370, y=1143..1171 +y=1086, x=398..420 +x=577, y=1450..1469 +x=519, y=1196..1204 +x=467, y=1199..1209 +x=544, y=1251..1269 +x=452, y=1279..1290 +x=402, y=18..26 +x=557, y=414..420 +x=569, y=1081..1109 +x=445, y=132..142 +x=395, y=551..564 +x=397, y=323..328 +y=183, x=456..459 +y=142, x=433..445 +x=569, y=557..583 +x=541, y=1584..1605 +y=672, x=500..516 +x=534, y=774..791 +y=45, x=421..429 +x=390, y=1540..1548 +x=556, y=1554..1570 +x=523, y=297..320 +x=517, y=963..965 +x=447, y=1123..1127 +x=557, y=352..356 +x=437, y=888..899 +x=533, y=39..63 +x=564, y=177..188 +x=574, y=731..734 +x=387, y=34..39 +x=509, y=788..799 +y=63, x=456..472 +y=1290, x=452..470 +x=372, y=1516..1524 +x=515, y=94..105 +x=444, y=721..747 +x=434, y=1708..1732 +x=408, y=1466..1476 +x=456, y=673..679 +y=73, x=397..399 +y=792, x=498..501 +y=126, x=525..543 +y=1065, x=572..579 +y=738, x=480..498 +y=691, x=576..579 +y=797, x=369..374 +x=568, y=1295..1320 +x=507, y=1648..1672 +x=420, y=1074..1086 +y=1372, x=422..471 +x=564, y=1056..1077 +x=564, y=489..505 +y=439, x=378..381 +x=549, y=1361..1370 +x=436, y=1383..1397 +y=438, x=404..406 +y=108, x=577..579 +x=478, y=444..457 +y=1045, x=403..421 +x=471, y=1360..1372 +y=1165, x=421..439 +x=562, y=356..375 +x=504, y=1102..1104 +x=572, y=50..58 +x=430, y=155..177 +x=482, y=869..884 +x=387, y=372..397 +x=460, y=1296..1307 +x=567, y=661..685 +x=564, y=975..978 +x=463, y=1632..1636 +x=378, y=1579..1581 +y=564, x=395..497 +y=422, x=521..532 +x=417, y=66..71 +x=462, y=1667..1678 +x=532, y=1648..1671 +y=342, x=386..388 +y=606, x=397..419 +y=857, x=462..483 +x=541, y=75..83 +y=1258, x=417..434 +x=543, y=62..68 +y=1191, x=467..487 +x=428, y=952..963 +x=445, y=30..46 +y=1036, x=512..514 +x=563, y=725..746 +x=414, y=1318..1322 +x=411, y=496..517 +y=460, x=404..424 +x=375, y=333..345 +x=470, y=962..989 +x=430, y=526..540 +x=376, y=249..257 +x=580, y=1389..1410 +x=467, y=1156..1161 +x=573, y=179..191 +y=426, x=466..472 +y=834, x=373..381 +y=1415, x=423..427 +x=538, y=1149..1151 +x=568, y=1140..1167 +x=468, y=694..697 +x=429, y=370..377 +x=447, y=865..878 +x=534, y=1164..1166 +y=1732, x=431..434 +x=425, y=244..249 +x=446, y=354..366 +x=423, y=1413..1415 +y=1188, x=376..454 +x=536, y=719..731 +y=733, x=485..487 +x=506, y=1028..1040 +x=374, y=1481..1509 +x=393, y=324..328 +x=571, y=157..168 +y=190, x=449..466 +x=424, y=616..622 +y=1229, x=565..568 +x=450, y=1646..1657 +x=367, y=1391..1395 +x=536, y=298..318 +x=410, y=301..310 +y=1456, x=383..399 +x=464, y=1284..1287 +y=1091, x=462..468 +x=578, y=1333..1340 +x=402, y=1059..1070 +x=452, y=1240..1249 +x=557, y=1458..1480 +x=394, y=333..345 +x=490, y=1176..1187 +x=455, y=1706..1716 +x=396, y=845..869 +x=564, y=1586..1589 +y=177, x=430..448 +y=1110, x=387..409 +x=450, y=1204..1206 +x=499, y=1417..1419 +x=487, y=787..799 +x=434, y=1120..1122 +x=503, y=415..416 +x=492, y=1497..1502 +x=496, y=278..281 +y=21, x=493..514 +y=1611, x=414..436 +y=623, x=394..399 +y=1386, x=497..517 +y=345, x=375..394 +x=535, y=1649..1671 +x=401, y=911..933 +x=583, y=974..978 +y=463, x=510..518 +y=1272, x=550..570 +y=961, x=557..576 +x=547, y=716..721 +x=394, y=166..173 +x=406, y=416..438 +x=511, y=1644..1666 +y=27, x=534..558 +y=1151, x=538..540 +x=540, y=752..763 +x=407, y=1078..1083 +x=396, y=1543..1553 +y=747, x=431..444 +y=153, x=468..488 +x=423, y=1459..1470 +x=427, y=1519..1532 +y=387, x=462..467 +x=365, y=1288..1291 +x=467, y=375..387 +x=579, y=534..551 +y=670, x=386..406 +y=328, x=393..397 +y=667, x=398..400 +y=532, x=498..521 +y=954, x=565..567 +y=1678, x=441..462 +x=382, y=884..892 +x=583, y=413..420 +y=473, x=448..465 +y=1375, x=372..379 +y=1014, x=544..565 +y=849, x=498..500 +x=482, y=999..1004 +y=290, x=528..550 +x=441, y=1239..1249 +x=418, y=7..29 +y=746, x=542..563 +x=410, y=401..425 +y=453, x=484..489 +y=492, x=506..513 +y=1497, x=490..492 +x=568, y=1425..1430 +x=487, y=82..86 +x=499, y=1654..1658 +y=628, x=567..573 +x=514, y=575..581 +x=460, y=727..740 +x=574, y=256..273 +x=435, y=1054..1066 +x=406, y=555..561 +y=1353, x=405..418 +x=493, y=11..21 +y=1440, x=559..574 +y=968, x=370..381 +x=407, y=1267..1269 +x=456, y=484..495 +x=522, y=1027..1040 +y=173, x=390..394 +x=565, y=951..954 +x=559, y=1379..1383 +y=1152, x=577..582 +x=448, y=1155..1161 +x=449, y=490..492 +x=490, y=760..773 +x=422, y=1264..1268 +y=1181, x=500..502 +x=420, y=678..692 +x=473, y=1553..1559 +x=505, y=769..782 +x=444, y=401..411 +x=449, y=180..190 +y=841, x=371..384 +y=622, x=424..441 +x=557, y=948..961 +x=457, y=405..407 +y=1475, x=493..506 +x=412, y=1016..1026 +y=736, x=449..451 +x=565, y=661..685 +y=189, x=509..527 +y=83, x=541..562 +y=1309, x=403..417 +y=182, x=383..411 +x=400, y=1291..1292 +x=510, y=1501..1503 +y=1529, x=558..575 +x=512, y=1634..1638 +x=413, y=1250..1275 +x=577, y=1125..1152 +x=548, y=1205..1214 +y=914, x=548..554 +x=388, y=338..342 +y=1414, x=387..392 +x=519, y=110..121 +x=485, y=1609..1628 +y=42, x=547..551 +x=503, y=453..467 +y=749, x=518..523 +y=164, x=552..563 +x=509, y=1176..1187 +y=1015, x=494..497 +x=410, y=1054..1066 +x=387, y=1561..1571 +x=551, y=1327..1332 +x=498, y=1485..1506 +y=712, x=526..543 +x=407, y=789..791 +x=466, y=728..740 +x=433, y=1406..1418 +x=370, y=1286..1287 +x=578, y=1682..1688 +y=1535, x=539..549 +x=558, y=1068..1072 +x=500, y=762..776 +x=435, y=933..944 +y=1147, x=385..401 +y=246, x=407..416 +x=478, y=422..435 +x=414, y=681..688 +y=375, x=562..576 +x=499, y=1304..1330 +x=506, y=1466..1475 +x=491, y=1212..1222 +x=501, y=792..794 +x=521, y=1312..1314 +y=492, x=447..449 +y=1532, x=579..581 +y=467, x=499..503 +x=441, y=1496..1517 +x=369, y=792..797 +x=508, y=845..859 +y=1227, x=372..389 +x=531, y=700..709 +x=562, y=445..446 +x=375, y=651..660 +x=488, y=137..153 +y=356, x=539..557 +y=1227, x=565..568 +y=869, x=396..412 +x=385, y=572..586 +x=516, y=659..672 +x=371, y=1066..1071 +x=444, y=1075..1083 +x=418, y=1622..1634 +x=435, y=1096..1107 +y=1187, x=490..509 +y=83, x=379..406 +x=506, y=1501..1503 +x=559, y=1416..1440 +x=441, y=1666..1678 +y=529, x=365..368 +x=459, y=1318..1331 +y=429, x=466..472 +x=416, y=244..246 +x=577, y=1357..1378 +x=457, y=356..369 +x=457, y=1204..1206 +x=438, y=1623..1634 +x=579, y=682..691 +y=1066, x=410..435 +y=933, x=389..401 +y=974, x=486..495 +y=1122, x=430..434 +x=515, y=1714..1726 +y=401, x=482..493 +x=483, y=1294..1307 +y=46, x=440..445 +x=495, y=487..492 +x=479, y=1687..1698 +y=776, x=377..380 +x=486, y=968..974 +x=427, y=971..982 +x=383, y=1711..1731 +x=485, y=82..86 +x=512, y=555..557 +x=416, y=48..57 +x=503, y=681..695 +x=428, y=1265..1268 +x=429, y=1620..1629 +x=539, y=351..356 +x=380, y=248..257 +y=692, x=400..420 +y=1511, x=465..476 +x=377, y=766..776 +x=435, y=911..922 +x=581, y=1515..1532 +x=456, y=183..186 +x=428, y=1381..1394 +x=528, y=385..391 +x=402, y=1267..1269 +x=482, y=1544..1550 +x=493, y=1466..1475 +y=1509, x=370..374 +x=568, y=542..546 +y=1397, x=420..436 +x=556, y=1196..1197 +y=1425, x=565..568 +x=468, y=1123..1127 +x=457, y=293..304 +y=1634, x=418..438 +x=418, y=1095..1107 +x=367, y=1287..1291 +x=412, y=957..964 +x=421, y=257..267 +x=484, y=505..518 +x=383, y=1638..1660 +y=994, x=507..516 +y=39, x=485..493 +y=1605, x=524..541 +y=307, x=552..555 +x=397, y=1578..1581 +x=532, y=1428..1453 +x=446, y=1075..1083 +y=1638, x=507..512 +x=372, y=1209..1227 +x=430, y=1339..1353 +x=429, y=34..45 +x=405, y=1332..1353 +y=1183, x=500..502 +x=425, y=1583..1592 +x=524, y=806..816 +x=404, y=444..460 +y=1470, x=412..423 +x=386, y=661..670 +x=453, y=1670..1672 +y=1127, x=447..468 +x=495, y=1136..1154 +x=441, y=616..622 +x=460, y=1584..1592 +x=397, y=596..606 +x=375, y=983..1010 +y=1578, x=438..455 +x=424, y=505..518 +x=546, y=1692..1713 +x=407, y=572..586 +x=512, y=1033..1036 +x=451, y=1529..1537 +x=532, y=996..1005 +x=480, y=727..738 +x=389, y=1016..1018 +y=1111, x=488..515 +x=402, y=1582..1592 +x=434, y=830..850 +x=368, y=502..529 +x=422, y=369..377 +x=570, y=1271..1272 +x=555, y=786..794 +x=549, y=1219..1232 +x=436, y=1602..1611 +x=408, y=958..964 +y=1662, x=399..404 +y=1071, x=371..378 +x=402, y=1218..1236 +y=1114, x=550..564 +x=373, y=832..834 +x=518, y=720..731 +y=1088, x=485..499 +x=548, y=1587..1589 +y=1312, x=372..398 +x=493, y=1531..1533 +x=467, y=1217..1229 +x=499, y=340..352 +y=1511, x=381..409 +y=1268, x=469..471 +x=505, y=1559..1561 +y=306, x=416..425 +x=499, y=1086..1088 +x=446, y=1469..1476 +y=815, x=430..450 +y=162, x=552..563 +x=473, y=864..878 +x=523, y=971..988 +x=573, y=542..546 +x=559, y=717..721 +x=387, y=1096..1110 +x=571, y=780..792 +x=411, y=1486..1489 +y=1214, x=548..551 +x=461, y=1284..1287 +y=804, x=420..444 +y=1559, x=450..473 +y=1629, x=423..429 +y=1087, x=435..452 +y=1419, x=381..398 +y=1607, x=395..402 +x=427, y=1244..1254 +x=542, y=1225..1241 +y=1476, x=390..408 +y=89, x=479..505 +x=471, y=273..284 +y=1083, x=444..446 +x=552, y=983..986 +y=1167, x=553..568 +x=582, y=1081..1109 +x=381, y=151..158 +x=478, y=360..370 +x=414, y=1601..1611 +y=596, x=539..563 +y=1161, x=448..467 +x=508, y=1102..1104 +x=429, y=753..758 +y=589, x=422..425 +x=523, y=1557..1569 +x=564, y=753..763 +y=1026, x=412..433 +y=794, x=555..566 +x=521, y=1485..1486 +y=224, x=429..450 +x=505, y=76..89 +x=541, y=1405..1419 +x=472, y=826..835 +x=398, y=1711..1731 +y=398, x=540..561 +x=524, y=73..85 +x=447, y=322..348 +x=478, y=1343..1345 +x=398, y=1300..1312 +x=514, y=1033..1036 +x=497, y=1374..1386 +y=1275, x=396..413 +y=1532, x=396..427 +x=420, y=1117..1129 +y=1636, x=463..466 +y=1383, x=533..559 +x=466, y=1631..1636 +y=326, x=371..385 +x=450, y=813..815 +x=371, y=839..841 +x=578, y=463..466 +x=491, y=1305..1330 +x=579, y=1037..1065 +y=546, x=568..573 +x=466, y=806..816 +x=582, y=1124..1152 +x=524, y=479..495 +x=391, y=1132..1144 +y=65, x=494..516 +x=584, y=1695..1718 +x=471, y=1257..1268 +x=417, y=1241..1258 +y=1486, x=521..544 +x=417, y=1483..1493 +y=757, x=470..487 +x=558, y=1501..1529 +x=557, y=196..207 +y=1473, x=400..402 +x=523, y=747..749 +x=498, y=510..532 +y=1469, x=571..577 +x=416, y=303..306 +x=543, y=1056..1077 +y=369, x=440..457 +x=429, y=1233..1234 +x=561, y=242..244 +x=527, y=1290..1317 +y=1268, x=422..428 +y=1672, x=492..507 +y=824, x=538..547 +x=535, y=887..899 +x=425, y=1244..1254 +y=720, x=492..513 +x=487, y=1173..1191 +x=447, y=429..431 +x=581, y=558..583 +x=496, y=111..121 +y=884, x=478..482 +x=561, y=256..273 +x=476, y=464..476 +x=488, y=1383..1396 +x=489, y=869..884 +x=422, y=881..893 +x=498, y=1600..1603 +x=475, y=1727..1739 +x=455, y=825..835 +y=1506, x=482..498 +x=375, y=1516..1524 +x=417, y=932..944 +y=1109, x=569..582 +x=517, y=689..691 +y=113, x=422..431 +x=566, y=785..794 +x=409, y=681..688 +x=390, y=1466..1476 +x=399, y=1654..1662 +x=435, y=1078..1087 +y=273, x=561..574 +y=697, x=431..443 +y=943, x=471..490 +y=986, x=420..439 +y=106, x=422..431 +y=452, x=450..468 +x=462, y=1069..1091 +x=528, y=202..204 +x=496, y=1212..1222 +y=1653, x=440..442 +x=498, y=849..854 +x=444, y=800..804 +x=477, y=851..854 +x=529, y=738..752 +x=539, y=576..596 +x=464, y=981..983 +x=389, y=766..776 +x=490, y=1497..1502 +x=439, y=245..249 +x=440, y=1651..1653 +x=449, y=590..592 +x=513, y=1589..1615 +x=367, y=1638..1660 +x=366, y=1017..1018 +x=440, y=357..369 +y=116, x=415..443 +x=446, y=182..193 +x=465, y=276..287 +y=1569, x=521..523 +y=517, x=394..411 +x=376, y=915..938 +y=1310, x=450..469 +x=452, y=232..248 +x=527, y=498..525 +x=420, y=955..966 +x=431, y=106..113 +x=478, y=869..884 +x=470, y=1278..1290 +y=685, x=565..567 +x=481, y=462..471 +x=422, y=106..113 +x=384, y=838..841 +y=82, x=427..430 +y=391, x=502..528 +x=486, y=1160..1164 +y=1164, x=486..495 +x=538, y=806..824 +x=379, y=396..404 +x=368, y=1143..1171 +y=1398, x=403..411 +x=439, y=673..679 +y=348, x=441..447 +y=121, x=496..519 +x=396, y=145..146 +x=431, y=866..881 +y=1670, x=555..573 +y=425, x=410..413 +x=463, y=1296..1307 +x=365, y=1664..1673 +y=1002, x=438..442 +x=429, y=8..29 +x=403, y=1716..1735 +x=556, y=180..191 +y=1144, x=412..437 +x=495, y=1159..1164 +y=1225, x=475..477 +x=515, y=1337..1348 +y=1729, x=419..424 +x=482, y=1486..1506 +x=477, y=338..349 +x=402, y=853..863 +x=430, y=64..82 +y=471, x=481..485 +x=404, y=415..438 +y=1698, x=462..479 +x=573, y=605..607 +x=448, y=462..473 +x=496, y=1531..1533 +x=478, y=256..264 +y=1332, x=549..551 +y=1102, x=504..508 +x=447, y=490..492 +y=731, x=485..487 +x=494, y=1568..1570 +x=561, y=1124..1132 +x=419, y=596..606 +x=371, y=303..326 +x=477, y=691..700 +x=520, y=221..233 +x=474, y=1114..1116 +x=400, y=144..146 +x=430, y=1381..1394 +x=556, y=1635..1638 +y=148, x=531..558 +x=548, y=907..914 +x=473, y=378..391 +x=469, y=1257..1268 +y=1340, x=578..581 +y=794, x=498..501 +x=405, y=1193..1219 +x=525, y=113..126 +y=1589, x=548..564 +x=499, y=297..320 +x=421, y=1036..1045 +x=551, y=1204..1214 +x=410, y=526..540 +x=517, y=1375..1386 +y=1118, x=530..532 +y=854, x=498..500 +y=1024, x=463..466 +y=476, x=476..493 +x=493, y=397..401 +x=470, y=1685..1695 +x=546, y=49..58 +x=450, y=1299..1310 +x=502, y=1181..1183 +x=576, y=1682..1688 +x=577, y=103..108 +x=438, y=997..1002 +x=521, y=1323..1326 +x=498, y=727..738 +y=525, x=527..533 +y=1571, x=418..422 +x=466, y=1448..1458 +y=168, x=547..571 +y=1058, x=453..470 +x=379, y=59..83 +x=497, y=1013..1015 +x=409, y=1501..1511 +x=403, y=1388..1398 +x=456, y=232..248 +x=552, y=902..904 +y=204, x=506..528 +x=479, y=217..228 +x=522, y=39..63 +x=539, y=1515..1535 +y=1695, x=468..470 +x=411, y=752..758 +x=405, y=1078..1083 +y=228, x=479..495 +x=487, y=731..733 +y=1672, x=447..453 +x=475, y=851..854 +y=592, x=441..449 +x=474, y=273..284 +x=507, y=976..994 +x=487, y=745..757 +x=569, y=61..68 +x=430, y=812..815 +y=966, x=420..437 +x=538, y=962..965 +x=457, y=377..391 +x=465, y=296..308 +x=383, y=1443..1456 +x=515, y=1100..1111 +x=521, y=930..934 +y=318, x=536..564 +y=1419, x=496..499 +x=485, y=731..733 +y=884, x=489..501 +x=542, y=726..746 +y=284, x=471..474 +x=518, y=747..749 +x=509, y=73..85 +x=390, y=846..851 +y=679, x=439..456 +y=988, x=523..529 +y=1657, x=431..450 +y=281, x=496..510 +x=464, y=1470..1476 +x=540, y=1149..1151 +x=407, y=251..253 +y=1486, x=409..411 +x=489, y=846..859 +y=264, x=432..440 +x=500, y=658..672 +y=1410, x=577..580 +x=393, y=1427..1436 +x=551, y=736..739 +x=444, y=908..918 +y=983, x=460..464 +y=313, x=506..509 +y=327, x=459..480 +y=941, x=425..428 +x=495, y=216..228 +y=540, x=410..430 +y=964, x=408..412 +x=479, y=75..89 +x=421, y=34..45 +x=385, y=1135..1147 +x=561, y=558..563 +x=521, y=449..472 +x=579, y=104..108 +x=446, y=908..918 +x=576, y=683..691 +y=407, x=457..461 +x=499, y=452..467 +y=892, x=382..394 +y=1005, x=532..536 +x=437, y=866..881 +x=411, y=180..182 +x=578, y=1205..1211 +x=421, y=831..850 +x=478, y=1381..1392 +x=528, y=262..290 +x=546, y=1564..1566 +y=261, x=432..440 +x=417, y=1587..1589 +x=579, y=390..408 +y=274, x=381..392 +x=532, y=1113..1118 +y=431, x=425..447 +x=424, y=1115..1125 +y=1222, x=491..496 +x=372, y=616..630 +x=507, y=1342..1344 +x=549, y=1514..1535 +x=428, y=930..941 +y=1570, x=494..503 +y=581, x=514..518 +x=558, y=135..148 +x=392, y=1404..1414 +x=503, y=1569..1570 +x=529, y=970..988 +y=1567, x=401..404 +y=1241, x=520..542 +x=543, y=1428..1453 +x=378, y=1542..1553 +y=1658, x=499..501 +y=835, x=455..472 +y=1113, x=530..532 +x=495, y=532..544 +y=922, x=435..452 +x=375, y=1285..1287 +x=526, y=773..791 +x=552, y=305..307 +y=982, x=425..427 +y=1320, x=568..582 +x=483, y=1218..1229 +x=586, y=236..247 +x=381, y=267..274 +y=1503, x=506..510 +x=425, y=428..431 +x=535, y=1554..1570 +y=1711, x=569..571 +x=442, y=1651..1653 +x=425, y=971..982 +x=377, y=396..404 +y=1246, x=475..477 +x=534, y=1505..1525 +y=586, x=385..407 +y=26, x=382..402 +y=1129, x=396..420 +y=561, x=406..470 +x=427, y=65..82 +y=1047, x=534..547 +x=422, y=1360..1372 +x=552, y=162..164 +x=498, y=792..794 +x=405, y=139..150 +x=505, y=1588..1615 +y=1068, x=555..558 +y=1073, x=512..518 +y=1419, x=527..541 +x=509, y=930..934 +x=521, y=1693..1713 +x=501, y=868..884 +y=965, x=517..538 +x=518, y=1052..1073 +y=1570, x=535..556 +y=268, x=467..484 +x=410, y=140..150 +y=186, x=456..459 +x=398, y=252..253 +y=955, x=455..464 +y=249, x=425..439 +x=562, y=75..83 +x=459, y=317..327 +x=421, y=1156..1165 +x=464, y=946..955 +y=1162, x=427..433 +x=447, y=1497..1517 +x=405, y=1407..1418 +y=681, x=409..414 +y=267, x=421..449 +x=519, y=1312..1314 +x=383, y=181..182 +y=1561, x=505..514 +x=533, y=1178..1203 +x=472, y=426..429 +y=1010, x=375..387 +x=476, y=1498..1511 +y=1203, x=528..533 +y=1154, x=532..549 +x=520, y=1224..1241 +x=547, y=34..42 +x=516, y=1505..1525 +y=1592, x=434..460 +x=488, y=361..370 +x=422, y=1559..1571 +x=547, y=806..824 +x=506, y=488..492 +x=501, y=1654..1658 +x=516, y=52..65 +y=557, x=512..521 +y=39, x=387..389 +y=660, x=375..379 +x=394, y=496..517 +x=521, y=1558..1569 +x=533, y=498..525 +x=394, y=1132..1144 +y=1083, x=405..407 +x=402, y=1597..1607 +y=918, x=444..446 +x=455, y=1562..1578 +x=443, y=695..697 +x=485, y=1690..1698 +y=1378, x=567..577 +y=963, x=428..430 +x=379, y=1361..1375 +x=471, y=920..943 +y=1104, x=425..429 +x=438, y=1318..1331 +x=470, y=745..757 +x=399, y=619..623 +x=452, y=910..922 +x=395, y=790..791 +y=1132, x=561..571 +y=257, x=376..380 +x=378, y=1065..1071 +y=1291, x=365..367 +x=554, y=907..914 +y=1144, x=391..394 +y=881, x=431..437 +y=1026, x=393..399 +y=1628, x=472..485 +y=1229, x=467..483 +x=468, y=1685..1695 +x=433, y=1016..1026 +y=1566, x=543..546 +x=400, y=880..901 +y=1413, x=423..427 +x=481, y=1259..1271 +y=1197, x=556..558 +y=1367, x=383..404 +x=393, y=1001..1026 +x=506, y=202..204 +y=1324, x=428..431 +x=437, y=1133..1144 +y=1726, x=503..515 +x=388, y=1540..1548 +x=516, y=976..994 +x=456, y=615..616 +x=371, y=916..938 +x=440, y=30..46 +y=307, x=506..509 +x=523, y=148..166 +x=499, y=1342..1344 +x=542, y=1458..1480 +y=1307, x=483..485 +x=459, y=695..697 +y=404, x=377..379 +x=406, y=660..670 +y=1249, x=441..452 +x=484, y=1519..1537 +x=434, y=1584..1592 +x=429, y=678..687 +y=1287, x=461..464 +x=564, y=1097..1114 +x=534, y=449..472 +y=1330, x=491..499 +x=467, y=402..411 +x=421, y=328..342 +y=663, x=445..467 +x=449, y=729..736 +x=567, y=177..188 +y=695, x=503..526 +y=1533, x=493..496 +y=739, x=551..556 +x=477, y=767..776 +y=264, x=476..478 +x=551, y=35..42 +x=370, y=950..968 +x=513, y=689..691 +x=431, y=720..747 +x=579, y=1514..1532 +y=1718, x=560..584 +x=399, y=1443..1456 +y=1688, x=576..578 +x=501, y=479..495 +x=573, y=627..628 +y=490, x=447..449 +x=412, y=1672..1678 +y=1592, x=402..425 +x=451, y=1131..1139 +x=440, y=1447..1458 +x=370, y=1481..1509 +x=558, y=23..27 +y=188, x=564..567 +y=58, x=546..572 +x=434, y=1241..1258 +x=482, y=396..401 +x=398, y=1401..1419 +y=1377, x=486..493 +x=560, y=1542..1545 +y=1344, x=499..507 +y=1209, x=442..467 +y=1660, x=367..383 +x=533, y=1378..1383 +x=372, y=1360..1375 +y=57, x=416..425 +x=450, y=1706..1716 +x=394, y=1218..1236 +x=572, y=1038..1065 +y=731, x=518..536 +x=426, y=679..687 +x=468, y=1069..1091 +y=895, x=546..568 +y=346, x=466..468 +x=418, y=1560..1571 +x=381, y=1501..1511 +x=565, y=1227..1229 +y=878, x=447..473 +y=1489, x=409..411 +y=1005, x=427..449 +x=415, y=92..116 +x=547, y=220..233 +x=567, y=276..294 +x=574, y=1220..1232 +x=530, y=1113..1118 +y=1581, x=378..397 +x=459, y=460..469 +x=511, y=1291..1317 +x=468, y=1132..1139 +x=492, y=707..720 +y=1345, x=478..480 +y=1340, x=531..542 +x=417, y=1304..1309 +x=474, y=999..1004 +y=1480, x=542..557 +y=1571, x=387..411 +x=450, y=1553..1559 +y=244, x=549..561 +x=571, y=1123..1132 +x=488, y=532..544 +x=460, y=981..983 +x=442, y=997..1002 +x=476, y=1381..1392 +y=1018, x=366..389 +x=423, y=183..193 +x=523, y=1362..1370 +y=792, x=571..581 +x=420, y=799..804 +y=1714, x=569..571 +x=406, y=58..83 +y=616, x=456..469 +y=981, x=460..464 +x=431, y=1319..1324 +x=428, y=1319..1324 +x=406, y=635..649 +x=556, y=736..739 +x=465, y=1237..1249 +y=1331, x=438..459 +y=68, x=543..569 +x=400, y=658..667 +x=488, y=1099..1111 +x=528, y=414..416 +y=370, x=478..488 +y=816, x=466..524 +x=400, y=1469..1473 +y=1436, x=393..481 +x=539, y=1636..1638 +y=1317, x=511..527 +x=497, y=1042..1064 +x=484, y=441..453 +x=485, y=1601..1603 +x=454, y=962..989 +x=476, y=256..264 +y=408, x=579..584 +x=399, y=1000..1026 +x=451, y=600..619 +x=485, y=1295..1307 +y=1716, x=450..455 +x=365, y=503..529 +x=485, y=1087..1088 +x=507, y=1634..1638 +x=412, y=1459..1470 +x=472, y=1608..1628 +x=540, y=557..563 +x=454, y=1175..1188 +x=494, y=52..65 +x=516, y=339..352 +y=287, x=465..482 +x=425, y=1193..1219 +x=441, y=321..348 +y=1204, x=495..519 +x=567, y=951..954 +y=1072, x=555..558 +x=411, y=1389..1398 +y=934, x=509..521 +x=387, y=1404..1414 +y=202, x=506..528 +x=403, y=1035..1045 +x=574, y=1236..1242 +x=448, y=156..177 +x=543, y=703..712 +x=462, y=1709..1719 +x=469, y=1298..1310 +x=518, y=1644..1666 +y=247, x=469..586 +y=320, x=499..523 +x=381, y=1401..1419 +y=986, x=552..577 +y=1453, x=532..543 +y=416, x=503..528 +y=435, x=459..478 +x=582, y=1295..1320 +x=500, y=1181..1183 +x=423, y=1620..1629 +x=427, y=995..1005 +x=555, y=1648..1670 +x=443, y=92..116 +x=504, y=31..43 +x=489, y=691..700 +x=532, y=420..422 +y=776, x=389..477 +x=398, y=576..579 +x=543, y=444..446 +y=1493, x=401..417 +y=146, x=396..400 +x=510, y=459..463 +x=485, y=462..471 +x=561, y=383..398 +x=389, y=1209..1227 +x=546, y=876..895 +x=527, y=1406..1419 +x=470, y=555..561 +x=477, y=1235..1246 +y=938, x=371..376 +x=425, y=571..589 +x=549, y=242..244 +x=485, y=36..39 +x=399, y=69..73 +y=1545, x=560..572 +x=478, y=146..150 +y=1077, x=543..564 +x=534, y=1030..1047 +y=619, x=451..453 +x=521, y=556..557 +x=401, y=1565..1567 +y=233, x=520..547 +y=1166, x=534..543 +x=375, y=1290..1292 +y=944, x=417..435 +x=567, y=1356..1378 +x=582, y=1236..1242 +y=799, x=487..509 +y=1254, x=425..427 +y=700, x=477..489 +y=310, x=410..433 +x=459, y=422..435 +y=472, x=521..534 +x=490, y=488..492 +y=1430, x=565..568 +y=756, x=454..467 +x=419, y=1708..1729 +y=1615, x=505..513 +y=485, x=574..581 +x=576, y=947..961 +x=468, y=335..346 +x=467, y=1172..1191 +x=584, y=389..408 +x=427, y=1413..1415 +y=1395, x=367..392 +y=989, x=454..470 +x=376, y=1663..1673 +x=526, y=1322..1326 +x=527, y=186..189 +x=496, y=1416..1419 +y=253, x=398..407 +x=549, y=1328..1332 +x=443, y=1114..1125 +x=553, y=535..551 +x=386, y=338..342 +y=1307, x=460..463 +y=850, x=421..434 +x=550, y=262..290 +x=394, y=884..892 +x=514, y=1558..1561 +x=451, y=729..736 +x=415, y=1587..1589 +x=435, y=1529..1537 +x=526, y=147..166 +x=472, y=53..63 +y=85, x=509..524 +x=462, y=847..857 +x=462, y=1688..1698 +y=1698, x=485..495 +x=407, y=243..246 +x=517, y=1251..1269 +y=740, x=460..466 +x=479, y=376..377 +y=773, x=490..493 +y=1524, x=372..375 +x=449, y=994..1005 +x=581, y=1334..1340 +x=495, y=1691..1698 +x=381, y=431..439 +x=400, y=576..579 +x=392, y=268..274 +x=468, y=319..323 +x=500, y=849..854 +x=571, y=1711..1714 +x=480, y=1342..1345 +x=424, y=1707..1729 +x=424, y=444..460 +y=721, x=547..559 +x=441, y=589..592 +x=551, y=490..505 +x=365, y=1519..1529 +x=425, y=1093..1104 +x=430, y=1120..1122 +y=469, x=456..459 +y=776, x=483..500 +y=1269, x=517..544 +y=1719, x=443..462 +x=492, y=1647..1672 +x=564, y=299..318 +y=1139, x=451..468 +x=389, y=34..39 +x=389, y=912..933 +y=1204, x=450..457 +x=461, y=405..407 +x=425, y=303..306 +x=538, y=1097..1125 +y=1234, x=429..452 +y=36, x=485..493 +y=1603, x=485..498 +x=431, y=1645..1657 +x=550, y=1270..1272 +x=484, y=259..268 +y=1348, x=488..515 +x=524, y=1584..1605 +x=512, y=1053..1073 +x=580, y=903..904 +x=466, y=335..346 +y=308, x=447..465 +x=459, y=293..304 +x=576, y=355..375 +y=1125, x=521..538 +y=1396, x=471..488 +x=573, y=1647..1670 +x=401, y=1483..1493 +y=607, x=570..573 +y=158, x=375..381 +y=377, x=479..494 +x=377, y=881..901 +x=473, y=319..323 +y=734, x=574..579 +y=1553, x=378..396 +x=396, y=1118..1129 +y=166, x=523..526 +x=404, y=1565..1567 +x=502, y=1519..1537 +x=435, y=484..495 +x=542, y=1325..1340 +y=901, x=377..400 +x=427, y=1153..1162 +x=505, y=1545..1550 +y=1107, x=418..435 +x=565, y=1425..1430 +y=563, x=540..561 +y=466, x=552..578 +x=484, y=1238..1249 +x=510, y=279..281 +y=248, x=452..456 +x=409, y=65..71 +y=1249, x=465..484 +x=521, y=1097..1125 +y=1671, x=532..535 +x=372, y=1300..1312 +x=430, y=952..963 +x=493, y=36..39 +y=1673, x=365..376 +y=1537, x=484..502 +x=467, y=744..756 +x=405, y=853..863 +x=392, y=1390..1395 +y=904, x=552..580 +y=1232, x=549..574 +y=691, x=513..517 +y=649, x=406..506 +x=563, y=162..164 +x=447, y=295..308 +x=581, y=780..792 +y=1638, x=539..556 +y=1735, x=403..412 +y=709, x=531..535 +x=563, y=575..596 +y=1322, x=403..414 +x=531, y=1325..1340 +x=398, y=1075..1086 +x=502, y=385..391 +y=1731, x=383..398 +x=466, y=426..429 +y=791, x=395..407 +x=449, y=258..267 +x=515, y=1136..1154 +x=465, y=463..473 +y=1171, x=368..370 +x=397, y=69..73 +x=532, y=1138..1154 +x=388, y=1060..1070 +x=521, y=510..532 +x=385, y=302..326 +x=425, y=48..57 +x=468, y=442..452 +y=1418, x=405..433 +x=465, y=1497..1511 +x=547, y=1031..1047 +x=445, y=1339..1353 +x=490, y=919..943 +y=1242, x=574..582 +y=446, x=543..562 +x=400, y=679..692 +x=568, y=1227..1229 +y=544, x=488..495 +y=457, x=478..496 +x=422, y=572..589 +x=534, y=22..27 +x=432, y=261..264 +x=471, y=1384..1396 +x=570, y=604..607 +y=150, x=478..481 +y=150, x=405..410 +x=481, y=146..150 +x=378, y=430..439 +y=1678, x=412..422 +y=1033, x=512..514 +y=191, x=556..573 +y=1713, x=521..546 +y=242, x=549..561 +y=1004, x=474..482 +x=401, y=1134..1147 +x=463, y=999..1024 +x=494, y=375..377 +y=518, x=424..484 +x=506, y=635..649 +y=1018, x=488..503 +x=404, y=1365..1367 +y=1739, x=451..475 +x=415, y=880..893 +x=503, y=1713..1726 +y=63, x=522..533 +x=543, y=1564..1566 +x=420, y=974..986 +y=651, x=540..551 +x=453, y=600..619 +y=1314, x=519..521 +x=540, y=635..651 +x=381, y=951..968 +y=1154, x=495..515 +y=1219, x=405..425 +y=1550, x=482..505 +x=488, y=1338..1348 +x=469, y=614..616 +x=574, y=1415..1440 +x=448, y=354..366 +y=899, x=437..535 +x=509, y=307..313 +x=390, y=371..397 +x=493, y=1364..1377 +y=1517, x=441..447 +y=71, x=409..417 +x=494, y=1013..1015 +y=997, x=438..442 +x=467, y=258..268 +x=551, y=635..651 +x=376, y=1174..1188 +x=402, y=1469..1473 +x=450, y=443..452 +y=1537, x=435..451 +y=304, x=457..459 +y=791, x=526..534 +x=462, y=375..387 +x=431, y=1708..1732 +x=395, y=1597..1607 +x=574, y=474..485 +y=1236, x=394..402 +y=688, x=409..414 +y=1269, x=402..407 +x=569, y=1711..1714 +y=630, x=372..406 +x=514, y=10..21 +y=105, x=515..535 +x=535, y=94..105 +x=513, y=488..492 +x=404, y=1653..1662 +x=396, y=1520..1532 +x=475, y=1235..1246 +x=412, y=844..869 +x=562, y=1205..1211 +y=1116, x=459..474 +y=763, x=540..564 +x=581, y=475..485 +x=555, y=1068..1072 +x=466, y=999..1024 +y=207, x=488..557 +x=577, y=984..986 +x=489, y=441..453 +x=553, y=1139..1167 +y=323, x=468..473 +y=1040, x=506..522 +x=412, y=1132..1144 +x=447, y=1670..1672 +x=431, y=695..697 +x=536, y=996..1005 +x=470, y=1039..1058 +x=565, y=995..1014 +x=456, y=460..469 +x=375, y=151..158 +x=381, y=1518..1529 +y=1271, x=463..481 +y=854, x=475..477 +y=851, x=372..390 +x=521, y=419..422 +y=1666, x=511..518 +x=413, y=402..425 +y=752, x=503..529 +x=466, y=181..190 +x=440, y=261..264 +y=859, x=489..508 +x=543, y=1164..1166 +x=518, y=574..581 +x=433, y=132..142 +x=526, y=681..695 +y=697, x=459..468 +y=1064, x=475..497 +y=863, x=402..405 +x=480, y=316..327 +x=452, y=1232..1234 +x=403, y=1318..1322 +x=382, y=18..26 +x=480, y=30..43 +x=429, y=197..224 +x=406, y=617..630 +x=439, y=1155..1165 +y=294, x=567..581 +x=518, y=458..463 +x=455, y=946..955 +y=1287, x=370..375 +x=372, y=846..851 +y=1502, x=490..492 +y=1211, x=562..578 +y=1529, x=365..381 +y=1476, x=446..464 +x=475, y=1215..1225 +y=1458, x=440..466 +x=409, y=1486..1489 +y=1654, x=499..501 +y=505, x=551..564 +x=463, y=1260..1271 +x=567, y=626..628 +y=1469, x=400..402 +x=509, y=186..189 +x=381, y=831..834 +x=379, y=652..660 +x=433, y=300..310 +x=560, y=1696..1718 +x=493, y=760..773 +y=978, x=564..583 +x=411, y=1562..1571 +x=495, y=969..974 +x=497, y=551..564 +y=1589, x=415..417 +x=412, y=1716..1735 +x=482, y=275..287 +x=380, y=765..776 +y=893, x=415..422 +x=558, y=1195..1197 +x=467, y=658..663 +y=420, x=557..583 +x=425, y=930..941 +x=483, y=846..857 +x=555, y=305..307 +x=544, y=996..1014 +y=555, x=406..470 +y=1070, x=388..402 +x=572, y=1542..1545 +x=531, y=134..148 +y=1370, x=523..549 +x=456, y=54..63 +y=579, x=398..400 +y=391, x=457..473 +x=571, y=1451..1469 +y=193, x=423..446 +y=492, x=490..495 +x=451, y=1728..1739 +x=503, y=1003..1018 +x=509, y=769..782 +x=394, y=619..623 +x=390, y=166..173 +y=411, x=444..467 +x=488, y=197..207 +y=551, x=553..579 +x=457, y=337..349 +x=459, y=183..186 +y=495, x=501..524 +y=1525, x=516..534 +y=1587, x=415..417 diff --git a/2018/day17/src/main.rs b/2018/day17/src/main.rs new file mode 100644 index 0000000..6ddd9be --- /dev/null +++ b/2018/day17/src/main.rs @@ -0,0 +1,55 @@ +use std::collections::VecDeque; +use std::fs::File; +use std::io::{BufRead, BufReader}; +use std::ops::Range; + +const MapSize: usize = 1800; +type Map = [[char; MapSize]; MapSize]; + +fn find_range_in_line(line: &str) -> (Range, Range) { + let mut parts = line.split(", "); + let mut left_parts = parts.nth(0).unwrap().split("="); + let left_coord_type: &str = left_parts.nth(0).unwrap(); + let left_number: u16 = left_parts.nth(0).unwrap().parse().unwrap(); + let mut right_parts = parts.nth(0).unwrap().split("="); + let mut right_numbers = right_parts.nth(1).unwrap().split(".."); + let right_number_1: u16 = right_numbers.nth(0).unwrap().parse().unwrap(); + let right_number_2: u16 = right_numbers.nth(0).unwrap().parse().unwrap(); + let left_range = Range { start: left_number, end: left_number + 1 }; + let right_range = Range { start: right_number_1, end: right_number_2 + 1 }; + if left_coord_type == "x" { + (left_range, right_range) + } else { + (right_range, left_range) + } +} + +fn build_map_from_file(filename: &str) -> Map { + let lines: Vec = BufReader::new(File::open(filename).unwrap()) + .lines() + .map(|line| line.unwrap()) + .collect(); + let mut min_y = MapSize; + let mut max_y = 0; + let mut m: Map = [[' '; MapSize]; MapSize]; + m[500][0] = '+'; + for line in lines.iter() { + let (x_range, y_range) = find_range_in_line(line.as_str()); + } + m +} + +fn main() { +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn test_range_from_line() { + let line = "x=100, y=100..102"; + let (x_range, y_range) = find_range_in_line(line); + assert_eq!(x_range, (100..101)); + assert_eq!(y_range, (100..103)); + } +} diff --git a/2018/day17/test-input b/2018/day17/test-input new file mode 100644 index 0000000..293b5af --- /dev/null +++ b/2018/day17/test-input @@ -0,0 +1,8 @@ +x=495, y=2..7 +y=7, x=495..501 +x=501, y=3..7 +x=498, y=2..4 +x=506, y=1..2 +x=498, y=10..13 +x=504, y=10..13 +y=13, x=498..504