diff --git a/2018/day17-input b/2018/day17-input new file mode 100644 index 0000000..1e2ccdd --- /dev/null +++ b/2018/day17-input @@ -0,0 +1,1713 @@ +y=1181, x=576..579 +y=434, x=498..503 +x=647, y=653..675 +y=1204, x=593..595 +y=268, x=475..498 +x=599, y=619..638 +y=1130, x=452..478 +x=439, y=1365..1377 +y=652, x=589..595 +y=1552, x=560..577 +x=439, y=852..867 +x=605, y=292..298 +x=489, y=709..718 +x=567, y=1087..1097 +y=1774, x=631..634 +x=649, y=592..612 +x=610, y=533..555 +x=564, y=996..1008 +x=651, y=416..441 +y=1106, x=502..519 +y=1015, x=479..487 +x=572, y=25..35 +x=630, y=849..865 +x=573, y=884..897 +x=614, y=667..688 +x=464, y=1542..1567 +x=645, y=258..270 +y=1029, x=656..662 +y=1502, x=483..511 +x=589, y=1553..1555 +x=535, y=1792..1795 +x=469, y=166..193 +x=484, y=1117..1142 +x=655, y=1277..1295 +x=598, y=162..170 +y=620, x=430..455 +x=665, y=1205..1212 +x=501, y=1347..1364 +x=661, y=664..684 +x=583, y=131..142 +x=542, y=722..727 +x=475, y=748..761 +x=602, y=1386..1393 +x=578, y=1651..1662 +y=1711, x=598..603 +y=164, x=642..660 +x=488, y=1176..1183 +x=644, y=207..221 +x=654, y=1678..1691 +y=1673, x=448..454 +x=630, y=1299..1312 +y=695, x=472..474 +x=465, y=1022..1045 +x=645, y=1216..1243 +x=623, y=423..437 +x=625, y=200..219 +x=565, y=1153..1166 +x=490, y=1510..1519 +x=553, y=941..947 +x=634, y=1101..1126 +x=515, y=111..113 +y=1146, x=427..438 +y=1096, x=451..460 +x=464, y=1339..1346 +x=612, y=1383..1396 +y=500, x=516..532 +x=555, y=941..947 +x=528, y=1243..1270 +x=646, y=1136..1146 +y=887, x=470..484 +x=617, y=316..343 +x=575, y=1060..1069 +y=1047, x=443..455 +y=1120, x=527..580 +x=514, y=126..135 +y=292, x=484..500 +x=556, y=75..91 +y=646, x=494..518 +x=644, y=552..568 +x=509, y=8..17 +y=735, x=591..614 +x=586, y=1215..1228 +y=1335, x=443..465 +y=495, x=522..526 +x=610, y=864..867 +y=221, x=639..644 +y=1346, x=464..469 +x=489, y=967..983 +x=602, y=1277..1289 +x=620, y=1348..1375 +x=575, y=1736..1744 +x=629, y=462..466 +y=270, x=645..652 +x=518, y=1244..1270 +x=576, y=1151..1162 +x=483, y=970..973 +y=1349, x=606..610 +y=1335, x=634..655 +y=1671, x=650..657 +x=619, y=243..265 +x=585, y=558..563 +x=536, y=1876..1887 +x=652, y=551..559 +x=593, y=1256..1268 +x=440, y=1480..1496 +y=1401, x=520..541 +x=624, y=1297..1306 +x=501, y=1510..1528 +x=587, y=567..575 +y=1470, x=560..580 +y=776, x=519..523 +x=601, y=981..983 +x=516, y=655..666 +y=1803, x=573..578 +x=504, y=1654..1677 +y=1931, x=537..667 +x=540, y=145..163 +x=616, y=204..210 +x=473, y=1856..1859 +x=547, y=241..259 +x=664, y=932..939 +x=475, y=306..316 +y=1572, x=622..628 +x=641, y=985..1001 +x=527, y=1572..1575 +x=447, y=1116..1124 +x=595, y=650..652 +y=1326, x=616..619 +x=626, y=822..835 +x=583, y=1063..1075 +x=576, y=1212..1222 +y=1206, x=486..495 +x=602, y=1885..1910 +x=460, y=1781..1805 +y=996, x=521..527 +x=591, y=1083..1103 +x=569, y=1563..1574 +y=785, x=560..579 +y=857, x=522..524 +x=599, y=804..805 +x=651, y=1724..1736 +y=637, x=449..467 +x=455, y=815..842 +x=476, y=1327..1345 +y=1533, x=615..624 +y=1268, x=633..655 +x=653, y=295..299 +x=522, y=388..415 +y=1365, x=462..487 +y=1430, x=428..438 +x=487, y=488..499 +y=1150, x=599..608 +x=559, y=1922..1927 +x=664, y=170..193 +y=1531, x=441..444 +y=1315, x=600..604 +x=603, y=1541..1543 +x=664, y=1401..1420 +x=580, y=322..345 +x=449, y=627..637 +y=1749, x=497..511 +x=577, y=1060..1069 +y=289, x=492..494 +x=443, y=1330..1335 +x=487, y=405..416 +x=603, y=18..33 +y=1312, x=612..630 +x=605, y=625..633 +x=546, y=1230..1232 +x=553, y=1126..1142 +x=441, y=936..943 +y=1715, x=544..641 +y=1693, x=594..596 +x=649, y=1151..1170 +x=490, y=405..416 +x=602, y=1602..1623 +y=142, x=580..583 +x=574, y=646..660 +y=789, x=479..485 +y=1093, x=640..655 +y=1200, x=501..508 +y=225, x=557..572 +x=591, y=727..735 +x=515, y=1653..1665 +x=467, y=489..499 +y=193, x=459..469 +x=593, y=1143..1162 +x=461, y=489..493 +x=547, y=198..217 +x=522, y=61..73 +x=626, y=1767..1779 +y=446, x=437..448 +y=840, x=443..451 +x=496, y=597..601 +x=650, y=1004..1013 +x=429, y=936..943 +x=557, y=812..822 +x=542, y=1633..1635 +x=469, y=1607..1615 +y=1654, x=624..626 +x=504, y=787..798 +x=569, y=1868..1875 +y=902, x=641..644 +y=1170, x=649..651 +x=606, y=532..555 +x=493, y=1509..1528 +x=452, y=1410..1425 +x=535, y=468..480 +x=599, y=1150..1158 +y=1486, x=429..437 +y=415, x=518..522 +x=511, y=1490..1502 +x=634, y=1765..1774 +x=539, y=869..879 +x=470, y=1413..1418 +x=516, y=1641..1648 +y=598, x=432..434 +x=494, y=807..818 +x=477, y=1875..1898 +x=577, y=77..98 +x=477, y=324..337 +x=451, y=1510..1535 +x=590, y=838..849 +x=565, y=1872..1898 +x=516, y=825..831 +x=541, y=869..879 +y=695, x=427..444 +x=437, y=1166..1194 +x=593, y=1279..1292 +x=518, y=469..480 +x=532, y=1851..1861 +y=1861, x=532..536 +y=1485, x=636..652 +y=1887, x=493..496 +x=436, y=749..766 +y=1268, x=593..610 +y=1145, x=512..520 +y=334, x=482..485 +y=1351, x=553..565 +x=491, y=1547..1556 +y=1908, x=530..549 +y=521, x=607..634 +x=602, y=1687..1698 +x=631, y=1725..1736 +y=1792, x=432..456 +x=530, y=1572..1575 +x=584, y=1154..1166 +x=620, y=1286..1292 +x=537, y=1918..1931 +x=608, y=1474..1489 +x=461, y=989..1006 +x=477, y=1672..1678 +y=1287, x=492..495 +y=1318, x=532..554 +x=463, y=12..30 +x=628, y=595..608 +x=560, y=778..785 +y=1624, x=472..480 +y=673, x=486..489 +x=475, y=1241..1254 +y=1479, x=472..485 +x=458, y=468..477 +y=1298, x=494..497 +x=641, y=1437..1447 +y=973, x=464..483 +y=1695, x=594..596 +x=460, y=1084..1096 +x=613, y=293..298 +x=503, y=1548..1556 +x=574, y=915..931 +y=25, x=482..501 +x=637, y=529..549 +x=441, y=1440..1453 +y=91, x=556..567 +x=432, y=1695..1711 +y=1375, x=620..644 +y=1912, x=553..556 +y=413, x=595..598 +x=584, y=1257..1281 +y=131, x=551..556 +x=493, y=573..576 +x=551, y=860..864 +x=469, y=79..91 +x=462, y=1144..1150 +x=513, y=812..814 +y=1789, x=582..607 +y=1246, x=590..592 +x=544, y=1703..1715 +y=677, x=480..496 +x=432, y=588..598 +x=566, y=556..559 +y=1926, x=511..515 +y=592, x=455..478 +x=610, y=1647..1659 +x=651, y=213..238 +y=1622, x=543..565 +x=451, y=90..104 +x=576, y=1174..1181 +y=1243, x=645..651 +x=553, y=1343..1351 +x=572, y=201..225 +x=648, y=947..970 +x=581, y=444..462 +x=459, y=36..59 +x=642, y=147..164 +x=561, y=1634..1635 +x=593, y=697..707 +x=557, y=200..225 +y=1077, x=457..461 +y=1429, x=600..626 +x=631, y=781..785 +x=565, y=1343..1351 +x=651, y=891..905 +x=445, y=1827..1843 +y=1711, x=432..460 +x=491, y=1819..1821 +x=558, y=725..730 +x=434, y=991..1012 +x=634, y=434..442 +x=452, y=527..540 +x=618, y=1479..1484 +x=644, y=621..626 +x=533, y=1526..1544 +y=831, x=490..516 +y=466, x=629..649 +y=1228, x=568..586 +x=567, y=1062..1075 +x=640, y=1747..1758 +x=579, y=777..785 +x=549, y=812..822 +y=1732, x=638..640 +y=490, x=576..594 +x=516, y=1495..1518 +x=620, y=1297..1306 +y=254, x=460..468 +x=475, y=254..268 +x=482, y=12..25 +y=1183, x=468..488 +x=587, y=666..675 +y=68, x=479..500 +x=524, y=1789..1801 +x=613, y=1046..1058 +x=580, y=567..575 +y=879, x=539..541 +x=448, y=533..537 +x=658, y=1363..1375 +y=410, x=427..438 +y=176, x=501..504 +x=491, y=783..794 +x=570, y=351..373 +y=259, x=521..547 +y=480, x=518..535 +y=633, x=605..607 +x=523, y=767..776 +y=898, x=552..556 +x=606, y=1340..1349 +x=494, y=631..646 +x=496, y=1688..1695 +y=821, x=634..642 +y=1393, x=602..605 +x=443, y=1175..1177 +x=531, y=851..861 +y=582, x=442..546 +y=864, x=551..570 +x=562, y=996..1008 +y=575, x=580..587 +x=529, y=1763..1775 +y=40, x=502..506 +y=73, x=522..529 +y=798, x=504..526 +y=628, x=513..529 +x=520, y=1657..1662 +y=1648, x=516..536 +y=1142, x=484..495 +x=492, y=302..315 +x=586, y=1176..1187 +y=512, x=516..518 +y=218, x=502..504 +y=515, x=516..518 +x=516, y=512..515 +x=444, y=690..695 +y=626, x=624..644 +x=637, y=1276..1295 +y=1370, x=592..595 +y=1860, x=609..620 +x=620, y=900..915 +x=614, y=727..735 +x=437, y=1464..1486 +y=1254, x=457..475 +y=910, x=583..585 +y=294, x=429..436 +y=398, x=481..501 +x=642, y=1768..1779 +y=1845, x=500..524 +y=1898, x=561..565 +y=712, x=571..573 +y=735, x=489..491 +y=887, x=586..589 +y=1518, x=516..521 +x=466, y=551..560 +x=472, y=1613..1624 +x=561, y=701..715 +y=33, x=599..603 +x=538, y=896..908 +x=568, y=1456..1464 +y=559, x=566..568 +x=515, y=328..356 +x=662, y=1020..1029 +x=624, y=355..377 +x=480, y=1612..1624 +y=1139, x=570..574 +y=1795, x=530..535 +x=516, y=490..500 +x=462, y=1830..1837 +x=437, y=202..223 +x=661, y=1504..1509 +x=451, y=470..481 +x=515, y=1836..1840 +x=633, y=189..191 +x=467, y=708..718 +x=528, y=900..902 +x=497, y=232..241 +x=588, y=1686..1698 +y=1306, x=620..624 +x=480, y=667..677 +x=493, y=9..21 +y=1416, x=490..515 +x=624, y=1507..1533 +x=436, y=290..294 +y=708, x=571..573 +x=462, y=601..615 +y=595, x=628..638 +y=1205, x=621..626 +x=582, y=1130..1142 +x=487, y=1000..1015 +x=651, y=1695..1703 +x=544, y=891..902 +x=459, y=165..193 +x=549, y=1897..1908 +y=1484, x=616..618 +x=556, y=1887..1912 +y=1868, x=462..480 +x=621, y=1177..1205 +x=561, y=1873..1898 +x=624, y=1475..1489 +y=1377, x=439..451 +y=943, x=429..441 +y=1553, x=610..615 +x=509, y=1048..1074 +x=483, y=915..928 +x=480, y=606..608 +x=580, y=1027..1043 +x=630, y=978..996 +x=516, y=1875..1887 +x=501, y=1190..1200 +y=377, x=624..632 +y=481, x=451..470 +y=555, x=606..610 +x=445, y=1542..1567 +x=514, y=1231..1233 +x=572, y=62..72 +y=1097, x=548..567 +x=593, y=1784..1786 +x=556, y=29..31 +x=514, y=34..44 +x=651, y=29..31 +x=601, y=1342..1352 +x=439, y=177..182 +x=522, y=853..857 +x=638, y=110..114 +y=1166, x=565..584 +x=549, y=447..457 +x=508, y=1896..1898 +x=525, y=1763..1775 +x=572, y=350..373 +x=583, y=273..301 +x=496, y=148..158 +x=427, y=690..695 +x=506, y=449..461 +x=622, y=592..612 +x=492, y=497..521 +x=554, y=962..972 +x=543, y=827..840 +y=91, x=469..487 +x=446, y=614..616 +x=477, y=453..456 +x=501, y=366..376 +y=487, x=564..568 +x=495, y=1188..1206 +x=530, y=1896..1908 +x=436, y=123..147 +x=471, y=1856..1859 +x=486, y=664..673 +y=770, x=573..583 +x=565, y=1403..1411 +x=599, y=18..33 +y=1599, x=556..577 +y=1411, x=565..567 +x=541, y=986..1012 +x=601, y=1083..1103 +y=1825, x=486..502 +y=1695, x=480..496 +x=440, y=122..147 +x=476, y=364..376 +y=409, x=449..463 +x=446, y=1143..1150 +x=536, y=1614..1619 +y=290, x=510..514 +y=600, x=454..459 +y=1837, x=562..579 +x=462, y=1851..1868 +x=544, y=278..297 +y=902, x=544..563 +x=580, y=1438..1447 +x=546, y=570..582 +x=644, y=1874..1875 +x=447, y=306..316 +x=556, y=277..297 +x=626, y=424..437 +y=806, x=549..557 +x=596, y=1693..1695 +y=936, x=444..451 +y=1156, x=486..510 +y=1567, x=445..464 +y=779, x=514..530 +x=536, y=1851..1861 +y=992, x=504..509 +x=535, y=329..356 +y=814, x=513..519 +y=210, x=604..616 +x=491, y=731..735 +x=558, y=1084..1093 +y=352, x=642..648 +x=425, y=591..601 +x=634, y=1586..1603 +x=554, y=599..608 +x=605, y=397..419 +x=514, y=267..290 +y=263, x=554..568 +x=473, y=911..937 +y=897, x=573..579 +x=595, y=1401..1409 +x=613, y=367..370 +y=1535, x=433..451 +x=573, y=767..770 +x=665, y=41..45 +y=1093, x=558..561 +x=454, y=1666..1673 +x=495, y=1662..1672 +x=566, y=220..222 +x=492, y=1268..1287 +x=534, y=808..818 +x=480, y=1852..1868 +y=282, x=590..616 +x=502, y=218..221 +y=1187, x=566..586 +x=598, y=317..343 +x=562, y=1833..1837 +x=499, y=470..481 +y=113, x=456..478 +y=1703, x=649..651 +x=454, y=598..600 +x=474, y=1058..1074 +x=498, y=434..436 +y=1680, x=481..483 +x=662, y=851..868 +y=987, x=563..565 +y=299, x=653..660 +y=1590, x=617..625 +y=608, x=476..480 +x=538, y=527..540 +y=246, x=488..504 +x=455, y=611..620 +x=490, y=345..356 +x=566, y=602..604 +y=1603, x=634..650 +x=608, y=1150..1158 +x=454, y=363..376 +y=1679, x=596..623 +x=483, y=1569..1571 +x=554, y=1309..1318 +x=660, y=146..164 +x=442, y=752..755 +x=514, y=850..861 +y=1142, x=531..553 +y=1509, x=653..661 +x=509, y=1836..1840 +x=604, y=1301..1315 +x=488, y=426..440 +x=475, y=1733..1758 +x=543, y=41..67 +x=527, y=1107..1120 +y=660, x=574..577 +x=502, y=1081..1106 +x=469, y=1428..1434 +y=564, x=488..492 +x=430, y=1435..1455 +x=547, y=919..929 +x=641, y=1560..1563 +x=480, y=646..657 +y=715, x=478..480 +x=622, y=193..215 +x=445, y=271..274 +x=612, y=1280..1292 +y=938, x=608..621 +x=526, y=1897..1898 +x=610, y=441..443 +x=610, y=666..688 +y=1887, x=516..536 +x=625, y=1287..1292 +x=512, y=1204..1207 +x=505, y=1292..1303 +y=1045, x=465..485 +x=485, y=327..334 +x=574, y=570..587 +x=463, y=394..409 +x=485, y=1460..1479 +y=457, x=549..552 +y=456, x=477..479 +x=453, y=758..770 +x=660, y=360..381 +y=1895, x=616..620 +x=530, y=93..101 +x=589, y=861..887 +x=657, y=41..45 +y=31, x=556..564 +y=1823, x=512..656 +x=542, y=381..398 +y=1897, x=616..620 +x=610, y=1922..1927 +y=675, x=635..647 +x=535, y=938..950 +x=525, y=180..188 +x=635, y=654..675 +y=356, x=515..535 +x=520, y=1525..1544 +x=469, y=1799..1801 +x=478, y=1780..1805 +x=604, y=204..210 +x=456, y=490..493 +x=504, y=1875..1898 +x=527, y=1013..1027 +x=521, y=974..996 +x=583, y=737..760 +x=598, y=410..413 +x=476, y=493..496 +x=478, y=588..592 +x=438, y=1134..1146 +x=639, y=172..182 +x=471, y=1826..1843 +x=489, y=731..735 +x=427, y=888..914 +x=490, y=215..224 +y=1287, x=644..649 +x=655, y=729..747 +x=493, y=1788..1792 +x=596, y=763..765 +y=1236, x=446..456 +x=442, y=590..601 +x=600, y=1277..1289 +y=1224, x=590..608 +x=452, y=1102..1130 +x=504, y=165..176 +x=494, y=1296..1298 +x=615, y=511..516 +x=512, y=1465..1469 +x=649, y=1280..1287 +x=656, y=1811..1823 +x=567, y=76..91 +y=111, x=502..510 +y=867, x=439..444 +x=638, y=595..608 +y=87, x=531..549 +x=484, y=278..292 +y=1364, x=501..511 +x=454, y=1848..1872 +x=607, y=821..835 +x=504, y=218..221 +y=1402, x=626..640 +x=468, y=244..254 +x=554, y=1735..1744 +y=540, x=452..538 +x=472, y=493..496 +x=434, y=1757..1760 +x=502, y=97..111 +x=630, y=1250..1254 +y=1479, x=616..618 +x=549, y=788..806 +x=522, y=198..217 +x=577, y=1539..1552 +x=639, y=206..221 +x=591, y=697..707 +x=514, y=1554..1581 +x=647, y=1325..1330 +x=597, y=192..215 +x=461, y=1058..1077 +y=1528, x=493..501 +x=503, y=191..203 +y=1348, x=431..435 +y=1898, x=477..504 +x=487, y=79..91 +y=1074, x=509..519 +x=601, y=1361..1373 +x=579, y=499..504 +x=640, y=243..265 +y=1922, x=435..438 +y=1267, x=429..448 +x=650, y=156..158 +x=449, y=1439..1453 +x=545, y=417..419 +y=521, x=492..504 +x=517, y=895..908 +y=315, x=492..510 +x=644, y=1280..1287 +y=666, x=512..516 +y=395, x=490..494 +x=433, y=1434..1455 +x=510, y=1595..1617 +x=588, y=763..765 +x=631, y=1550..1552 +x=612, y=1102..1126 +y=1635, x=542..561 +x=526, y=787..798 +x=580, y=1497..1511 +x=603, y=1709..1711 +x=471, y=947..963 +y=730, x=558..564 +x=496, y=168..180 +x=435, y=1331..1348 +y=983, x=489..501 +y=257, x=597..613 +x=617, y=1343..1352 +x=598, y=498..504 +x=580, y=78..98 +y=104, x=441..451 +x=500, y=279..292 +x=626, y=1419..1429 +x=613, y=254..257 +x=610, y=1552..1553 +y=1418, x=470..472 +x=470, y=1038..1041 +y=1375, x=652..658 +y=230, x=457..467 +x=547, y=1370..1395 +x=597, y=1324..1349 +x=504, y=235..246 +x=499, y=728..739 +y=1910, x=602..627 +y=1830, x=456..462 +x=487, y=445..459 +x=525, y=590..610 +y=238, x=651..654 +x=587, y=367..370 +y=1336, x=554..575 +y=462, x=566..581 +x=452, y=1167..1194 +y=798, x=626..643 +x=507, y=507..518 +x=554, y=1523..1525 +x=536, y=1766..1778 +x=539, y=1465..1469 +x=465, y=1329..1335 +x=516, y=1697..1722 +y=970, x=644..648 +y=739, x=483..499 +x=625, y=1584..1590 +x=631, y=1765..1774 +x=598, y=1709..1711 +y=1330, x=645..647 +y=914, x=427..455 +y=1177, x=443..445 +x=618, y=1142..1162 +x=434, y=588..598 +y=560, x=450..466 +x=621, y=921..938 +y=481, x=478..499 +x=620, y=1857..1860 +x=577, y=843..845 +x=486, y=1647..1649 +x=589, y=534..537 +x=576, y=216..223 +y=606, x=476..480 +x=500, y=1831..1845 +x=450, y=644..650 +x=490, y=1401..1416 +x=581, y=63..72 +x=547, y=543..563 +x=605, y=1386..1393 +y=1249, x=575..599 +x=518, y=632..646 +y=563, x=581..585 +y=1805, x=460..478 +x=551, y=125..131 +x=483, y=366..376 +y=1013, x=645..650 +y=1560, x=641..649 +x=664, y=1267..1295 +y=462, x=543..560 +y=221, x=502..504 +x=604, y=101..107 +y=1263, x=602..604 +x=624, y=621..626 +y=996, x=630..632 +y=1659, x=567..571 +y=851, x=606..608 +y=928, x=483..486 +y=840, x=523..543 +y=1649, x=463..486 +x=592, y=1358..1370 +y=1615, x=457..469 +y=1295, x=546..550 +x=581, y=855..868 +y=698, x=462..480 +x=594, y=864..867 +x=593, y=216..223 +x=552, y=723..727 +y=707, x=591..593 +y=1142, x=565..582 +x=496, y=127..135 +x=637, y=1197..1223 +x=608, y=839..851 +x=641, y=1703..1715 +y=745, x=506..518 +x=536, y=1205..1207 +y=1233, x=502..514 +x=447, y=1732..1758 +x=627, y=529..549 +y=1008, x=562..564 +y=1784, x=593..598 +x=496, y=407..421 +x=583, y=163..170 +x=595, y=1193..1204 +x=519, y=1049..1074 +x=509, y=971..992 +y=785, x=631..634 +x=495, y=1117..1142 +y=1563, x=641..649 +x=540, y=591..603 +x=572, y=838..849 +y=1898, x=508..526 +y=568, x=642..644 +y=1571, x=576..585 +y=1001, x=453..455 +x=448, y=1702..1704 +x=553, y=141..164 +y=559, x=647..652 +y=297, x=544..556 +x=451, y=925..936 +x=626, y=1400..1402 +x=467, y=1058..1074 +x=502, y=1230..1233 +y=376, x=454..476 +x=487, y=1354..1365 +x=537, y=1554..1581 +x=495, y=1269..1287 +y=1212, x=656..665 +x=519, y=1082..1106 +x=628, y=728..747 +x=552, y=1652..1662 +x=510, y=98..111 +x=640, y=1730..1732 +y=1035, x=539..558 +x=616, y=1479..1484 +x=472, y=1460..1479 +x=626, y=771..798 +x=520, y=1395..1401 +y=163, x=533..540 +y=931, x=574..578 +y=1455, x=430..433 +x=552, y=674..689 +x=579, y=1832..1837 +x=467, y=208..230 +x=650, y=1587..1603 +x=464, y=969..973 +x=565, y=1129..1142 +x=660, y=294..299 +y=180, x=496..513 +x=622, y=1566..1572 +y=1556, x=491..503 +y=516, x=612..615 +y=1006, x=445..461 +x=574, y=404..411 +x=485, y=787..789 +x=548, y=1086..1097 +x=538, y=7..25 +x=504, y=971..992 +x=517, y=9..17 +x=615, y=803..805 +x=570, y=998..1012 +x=519, y=767..776 +x=571, y=708..712 +y=1295, x=637..655 +y=215, x=597..622 +x=569, y=737..760 +y=1779, x=626..642 +x=549, y=81..87 +y=135, x=496..514 +x=644, y=848..865 +x=543, y=417..419 +x=551, y=591..603 +y=939, x=585..591 +x=498, y=947..963 +x=568, y=1214..1228 +x=588, y=1477..1489 +x=586, y=1196..1207 +x=514, y=749..761 +x=455, y=548..557 +y=1162, x=576..578 +x=481, y=1326..1345 +y=1069, x=575..577 +x=573, y=1777..1803 +x=483, y=1490..1502 +x=595, y=410..413 +x=636, y=1463..1485 +y=1001, x=641..655 +x=486, y=1189..1206 +x=488, y=190..203 +x=493, y=1883..1887 +x=560, y=1539..1552 +x=455, y=992..1001 +x=564, y=482..487 +y=1292, x=593..612 +y=587, x=559..574 +x=436, y=37..59 +x=549, y=872..885 +x=456, y=177..182 +y=991, x=552..572 +y=812, x=513..519 +x=469, y=1338..1346 +x=500, y=1570..1571 +x=518, y=721..745 +y=1821, x=491..493 +x=429, y=1239..1267 +x=430, y=749..766 +x=470, y=471..481 +x=532, y=491..500 +x=612, y=1796..1805 +x=478, y=1103..1130 +x=478, y=471..481 +x=647, y=931..939 +y=983, x=601..622 +x=628, y=1565..1572 +x=631, y=1197..1223 +y=1489, x=570..588 +x=460, y=926..934 +x=542, y=112..113 +x=444, y=482..503 +x=557, y=789..806 +x=446, y=12..30 +x=635, y=1557..1567 +x=660, y=1197..1200 +x=565, y=977..987 +y=549, x=627..637 +x=654, y=213..238 +y=504, x=579..598 +x=565, y=1627..1640 +y=885, x=531..549 +x=474, y=683..695 +x=531, y=380..398 +x=445, y=1175..1177 +y=1455, x=548..550 +y=1235, x=536..556 +x=627, y=1249..1254 +x=595, y=1358..1370 +x=459, y=598..600 +x=496, y=910..937 +x=580, y=1108..1120 +y=1840, x=509..515 +x=499, y=324..337 +x=575, y=1893..1914 +x=593, y=1892..1914 +x=599, y=1239..1249 +x=520, y=1137..1145 +y=343, x=598..617 +x=575, y=1238..1249 +y=947, x=553..555 +x=568, y=482..487 +x=556, y=1224..1235 +y=241, x=495..497 +x=454, y=124..138 +x=550, y=1438..1455 +x=645, y=1004..1013 +y=1722, x=514..516 +x=486, y=915..928 +y=768, x=547..561 +x=499, y=1789..1792 +x=531, y=871..885 +y=1805, x=606..612 +x=437, y=1757..1760 +y=1158, x=599..608 +x=480, y=713..715 +x=541, y=1396..1401 +x=441, y=89..104 +y=493, x=456..461 +x=648, y=359..381 +x=552, y=1043..1053 +x=634, y=1318..1335 +y=1345, x=476..481 +x=620, y=1895..1897 +y=223, x=437..442 +x=432, y=271..274 +x=429, y=1463..1486 +x=579, y=884..897 +x=577, y=1585..1599 +y=141, x=610..633 +y=1075, x=567..583 +y=1270, x=518..528 +x=572, y=980..991 +y=35, x=551..572 +x=656, y=1205..1212 +y=1914, x=575..593 +x=441, y=1516..1531 +y=1801, x=524..550 +x=439, y=614..616 +y=604, x=566..572 +y=222, x=563..566 +x=531, y=674..689 +y=1281, x=559..584 +x=590, y=1222..1224 +x=633, y=120..141 +x=451, y=1365..1377 +x=595, y=534..537 +y=219, x=625..635 +y=1413, x=588..608 +x=470, y=445..459 +y=615, x=462..486 +y=1659, x=610..632 +x=585, y=950..974 +x=603, y=1583..1596 +y=747, x=628..655 +y=1519, x=472..490 +x=643, y=771..798 +x=578, y=914..931 +y=1678, x=461..477 +x=498, y=1531..1542 +y=101, x=627..641 +x=667, y=1918..1931 +x=455, y=587..592 +x=632, y=979..996 +y=1331, x=603..625 +x=519, y=792..794 +y=1223, x=631..637 +x=560, y=1458..1470 +y=1511, x=556..580 +x=610, y=998..1020 +x=441, y=532..537 +y=608, x=628..638 +y=158, x=650..653 +x=568, y=253..263 +y=608, x=554..578 +x=488, y=552..564 +y=1778, x=520..536 +x=430, y=610..620 +x=493, y=1532..1542 +x=497, y=1743..1749 +y=223, x=576..593 +x=500, y=878..881 +x=512, y=427..440 +y=822, x=549..557 +x=551, y=181..188 +y=1640, x=565..618 +x=432, y=1788..1792 +y=437, x=623..626 +x=608, y=1403..1413 +y=1786, x=593..598 +y=1289, x=600..602 +x=477, y=1590..1599 +x=467, y=628..637 +x=513, y=627..628 +y=164, x=553..565 +x=658, y=1400..1420 +x=438, y=645..650 +x=554, y=1422..1437 +x=514, y=1696..1722 +x=492, y=553..564 +x=632, y=1136..1146 +x=648, y=1679..1691 +x=472, y=1412..1418 +y=421, x=479..496 +x=444, y=1745..1773 +x=454, y=645..657 +x=479, y=1000..1015 +x=493, y=1819..1821 +x=490, y=382..395 +x=472, y=683..695 +x=543, y=1609..1622 +x=616, y=1895..1897 +y=881, x=500..515 +y=557, x=455..459 +x=657, y=1656..1671 +y=356, x=468..490 +x=584, y=1028..1043 +y=537, x=589..595 +x=580, y=702..715 +y=657, x=454..480 +x=642, y=810..821 +x=572, y=602..604 +x=474, y=1038..1041 +x=655, y=985..1001 +x=563, y=890..902 +y=107, x=604..614 +x=571, y=1654..1659 +x=609, y=947..963 +x=526, y=488..495 +x=612, y=511..516 +x=466, y=925..934 +x=575, y=542..563 +x=456, y=1224..1236 +y=1927, x=559..610 +y=1124, x=428..447 +x=641, y=899..902 +x=490, y=824..831 +x=600, y=1302..1315 +x=616, y=172..182 +y=527, x=565..567 +y=1596, x=581..603 +y=21, x=491..493 +x=566, y=443..462 +y=1792, x=493..499 +x=607, y=493..521 +y=381, x=648..660 +x=545, y=1519..1530 +y=67, x=535..543 +x=506, y=37..40 +x=529, y=626..628 +y=1043, x=580..584 +x=464, y=784..794 +x=500, y=54..68 +y=934, x=460..466 +y=477, x=458..464 +x=550, y=1789..1801 +x=460, y=245..254 +y=274, x=432..445 +y=204, x=604..616 +x=591, y=919..939 +x=438, y=1915..1922 +x=592, y=1563..1574 +y=1623, x=592..602 +x=445, y=989..1006 +y=1150, x=446..462 +x=567, y=501..527 +x=474, y=125..138 +x=501, y=11..25 +y=1396, x=590..612 +x=652, y=1463..1485 +x=478, y=102..113 +x=479, y=408..421 +x=578, y=1151..1162 +x=461, y=122..135 +x=640, y=111..114 +x=461, y=1671..1678 +x=489, y=1654..1677 +y=135, x=461..466 +x=536, y=1225..1235 +x=579, y=843..845 +y=170, x=583..598 +x=524, y=1832..1845 +x=501, y=165..176 +x=457, y=1059..1077 +x=466, y=122..135 +x=652, y=1442..1456 +x=565, y=500..527 +y=1792, x=530..535 +y=1295, x=659..664 +x=427, y=386..410 +y=31, x=648..651 +x=509, y=597..601 +x=585, y=1324..1349 +x=623, y=1668..1679 +x=435, y=1849..1872 +x=445, y=147..158 +y=1544, x=520..533 +x=592, y=1243..1246 +x=556, y=1585..1599 +x=624, y=947..963 +y=781, x=631..634 +x=626, y=1654..1656 +x=527, y=973..996 +x=442, y=1340..1350 +y=1662, x=520..530 +x=602, y=1260..1263 +x=606, y=1796..1805 +x=633, y=890..905 +x=494, y=35..44 +x=456, y=1788..1792 +x=498, y=255..268 +y=1656, x=624..626 +y=1162, x=593..618 +x=510, y=1154..1156 +x=633, y=1258..1268 +x=547, y=765..768 +y=217, x=522..547 +x=444, y=926..936 +x=581, y=1582..1596 +x=593, y=1193..1204 +x=471, y=1799..1801 +x=483, y=1589..1599 +y=849, x=572..590 +y=1837, x=456..462 +x=496, y=666..677 +x=458, y=753..755 +x=468, y=345..356 +x=511, y=214..224 +x=444, y=853..867 +y=1469, x=512..539 +x=523, y=589..610 +y=761, x=475..514 +x=439, y=326..335 +x=597, y=255..257 +x=579, y=1212..1222 +x=426, y=954..975 +x=489, y=1293..1303 +x=615, y=1551..1553 +x=582, y=1541..1543 +x=650, y=1656..1671 +x=575, y=1324..1336 +x=568, y=1519..1530 +y=147, x=436..440 +x=638, y=189..191 +x=627, y=77..101 +x=518, y=512..515 +x=515, y=1400..1416 +y=684, x=657..661 +y=1654, x=567..571 +y=1856, x=471..473 +y=1875, x=631..644 +x=494, y=382..395 +x=524, y=853..857 +x=645, y=1478..1480 +x=552, y=447..457 +y=612, x=622..649 +x=645, y=169..193 +x=462, y=1354..1365 +y=1555, x=589..606 +x=428, y=1746..1773 +x=590, y=1383..1396 +x=647, y=552..559 +y=503, x=444..446 +y=25, x=523..538 +y=1672, x=495..498 +y=794, x=511..519 +x=663, y=1557..1567 +y=1012, x=425..434 +x=495, y=232..241 +x=478, y=713..715 +x=484, y=861..887 +y=1464, x=568..571 +x=655, y=1319..1335 +y=1373, x=584..601 +y=576, x=493..532 +x=574, y=1127..1139 +y=1456, x=652..665 +x=455, y=888..914 +y=1859, x=471..473 +x=649, y=461..466 +x=579, y=1174..1181 +y=1425, x=445..452 +y=1194, x=437..452 +x=556, y=124..131 +y=496, x=472..476 +y=718, x=467..489 +x=652, y=1363..1375 +x=627, y=1884..1910 +y=794, x=464..491 +y=1437, x=554..561 +x=550, y=999..1012 +x=578, y=598..608 +x=446, y=481..503 +x=581, y=558..563 +x=481, y=384..398 +x=559, y=1256..1281 +y=937, x=473..496 +x=585, y=1568..1571 +x=465, y=758..770 +y=867, x=594..610 +y=805, x=599..615 +y=1395, x=547..575 +x=511, y=792..794 +y=675, x=568..587 +y=1207, x=512..536 +y=845, x=577..579 +x=470, y=860..887 +x=481, y=1675..1680 +x=642, y=553..568 +y=974, x=585..599 +x=479, y=55..68 +x=583, y=768..770 +x=518, y=387..415 +x=443, y=1020..1047 +x=480, y=686..698 +x=616, y=620..638 +x=592, y=1602..1623 +x=612, y=1300..1312 +x=550, y=1273..1295 +y=461, x=506..525 +y=316, x=447..475 +x=638, y=1730..1732 +x=634, y=781..785 +x=521, y=1496..1518 +x=563, y=977..987 +y=1496, x=440..465 +x=510, y=266..290 +x=519, y=812..814 +x=497, y=1595..1618 +x=438, y=387..410 +x=448, y=436..446 +x=658, y=224..247 +x=455, y=1021..1047 +y=459, x=470..487 +x=479, y=453..456 +x=443, y=833..840 +x=528, y=1614..1619 +x=448, y=1240..1267 +x=542, y=1230..1232 +x=632, y=354..377 +x=511, y=1743..1749 +y=1027, x=513..527 +y=963, x=471..498 +x=464, y=468..477 +y=939, x=647..664 +x=433, y=1510..1535 +x=511, y=1346..1364 +x=553, y=1886..1912 +x=602, y=441..443 +x=551, y=26..35 +y=376, x=483..501 +y=1698, x=588..602 +x=640, y=1400..1402 +x=536, y=414..424 +x=506, y=722..745 +x=502, y=1809..1825 +y=1691, x=648..654 +x=449, y=395..409 +x=643, y=1478..1480 +x=600, y=1418..1429 +x=502, y=37..40 +y=908, x=517..538 +y=1074, x=467..474 +y=1662, x=552..578 +x=514, y=1596..1617 +y=441, x=651..663 +x=445, y=1411..1425 +y=894, x=552..556 +y=1058, x=613..628 +x=645, y=1325..1330 +y=1568, x=576..585 +y=370, x=587..613 +x=515, y=878..881 +x=442, y=203..223 +x=435, y=1914..1922 +y=1420, x=658..664 +x=530, y=1792..1795 +y=443, x=602..610 +x=598, y=1784..1786 +x=607, y=625..633 +x=537, y=1653..1665 +x=524, y=900..902 +x=561, y=1084..1093 +x=468, y=1175..1183 +y=766, x=430..436 +x=645, y=1891..1908 +x=663, y=416..441 +x=425, y=992..1012 +x=457, y=1608..1615 +y=1349, x=585..597 +y=1760, x=434..437 +y=1200, x=656..660 +x=513, y=1013..1027 +y=688, x=610..614 +x=523, y=828..840 +y=59, x=436..459 +y=715, x=561..580 +x=570, y=1127..1139 +x=585, y=998..1020 +x=501, y=385..398 +x=590, y=1243..1246 +x=536, y=1747..1758 +y=835, x=607..626 +y=424, x=536..552 +x=622, y=980..983 +x=604, y=1260..1263 +x=648, y=343..352 +x=645, y=435..442 +x=536, y=1640..1648 +y=770, x=453..465 +x=552, y=894..898 +x=606, y=839..851 +y=1736, x=631..651 +x=564, y=29..31 +y=1434, x=469..490 +x=521, y=242..259 +y=114, x=638..640 +y=765, x=588..596 +x=577, y=647..660 +x=606, y=1552..1555 +x=653, y=1505..1509 +y=1617, x=510..514 +y=499, x=467..487 +y=915, x=607..620 +y=1908, x=637..645 +x=463, y=1646..1649 +x=483, y=1674..1680 +y=1677, x=489..504 +y=373, x=570..572 +x=624, y=1654..1656 +x=453, y=1897..1912 +x=585, y=919..939 +x=626, y=1177..1205 +x=529, y=61..73 +x=531, y=1125..1142 +x=450, y=550..560 +y=1012, x=550..570 +x=583, y=906..910 +x=592, y=1869..1875 +y=865, x=630..644 +x=490, y=1428..1434 +x=582, y=1773..1789 +x=655, y=1258..1268 +x=608, y=1223..1224 +x=558, y=1023..1035 +x=486, y=601..615 +x=635, y=201..219 +x=659, y=1267..1295 +x=576, y=1568..1571 +y=1704, x=448..453 +x=503, y=434..436 +y=72, x=572..581 +x=657, y=663..684 +x=665, y=1443..1456 +x=453, y=1702..1704 +x=580, y=1459..1470 +x=588, y=1404..1413 +x=524, y=1854..1867 +y=905, x=633..651 +x=567, y=1044..1053 +x=499, y=701..713 +y=601, x=425..442 +y=1883, x=493..496 +x=492, y=276..289 +y=193, x=645..664 +y=442, x=634..645 +x=610, y=121..141 +x=570, y=1478..1489 +x=427, y=1133..1146 +x=652, y=257..270 +y=1126, x=612..634 +x=568, y=667..675 +x=559, y=403..411 +y=224, x=490..511 +y=537, x=441..448 +x=642, y=343..352 +y=518, x=507..529 +x=561, y=765..768 +x=586, y=862..887 +x=614, y=102..107 +x=451, y=1083..1096 +x=533, y=144..163 +x=522, y=488..495 +x=557, y=322..345 +y=1775, x=525..529 +x=585, y=906..910 +x=644, y=899..902 +y=610, x=523..525 +x=476, y=606..608 +y=1041, x=470..474 +y=603, x=540..551 +y=1574, x=569..592 +x=594, y=476..490 +y=1254, x=627..630 +x=610, y=1340..1349 +x=510, y=301..315 +x=535, y=40..67 +x=485, y=1023..1045 +x=644, y=948..970 +x=459, y=548..557 +y=1409, x=595..599 +y=1665, x=515..537 +x=653, y=156..158 +y=247, x=658..662 +x=483, y=728..739 +y=861, x=514..531 +y=1801, x=469..471 +y=17, x=509..517 +y=818, x=494..534 +x=610, y=1257..1268 +y=1489, x=608..624 +x=649, y=1560..1563 +y=950, x=535..561 +y=713, x=499..511 +y=301, x=570..583 +x=463, y=816..842 +x=573, y=961..972 +y=335, x=439..453 +x=496, y=1883..1887 +x=556, y=1523..1525 +x=515, y=1904..1926 +x=656, y=1197..1200 +x=456, y=103..113 +x=617, y=1583..1590 +y=1543, x=582..603 +x=570, y=274..301 +x=460, y=1696..1711 +y=1758, x=536..640 +x=437, y=435..446 +x=465, y=1479..1496 +y=1020, x=585..610 +x=641, y=77..101 +y=929, x=527..547 +x=618, y=1627..1640 +y=601, x=496..509 +x=651, y=1217..1243 +x=494, y=276..289 +x=656, y=1021..1029 +x=616, y=266..282 +x=619, y=1324..1326 +y=616, x=439..446 +x=514, y=770..779 +x=616, y=1324..1326 +y=899, x=641..644 +y=1103, x=591..601 +y=1710, x=659..663 +x=542, y=1853..1867 +x=488, y=234..246 +y=1352, x=601..617 +x=523, y=6..25 +x=630, y=1231..1233 +x=444, y=1339..1350 +y=975, x=426..434 +x=438, y=1412..1430 +x=546, y=1272..1295 +y=1530, x=545..568 +x=590, y=266..282 +y=868, x=656..662 +x=603, y=1320..1331 +x=457, y=1241..1254 +x=498, y=1662..1672 +x=573, y=856..868 +x=634, y=494..521 +x=552, y=979..991 +x=532, y=573..576 +x=428, y=1412..1430 +y=158, x=445..496 +x=644, y=1347..1375 +y=182, x=616..639 +x=491, y=9..21 +x=532, y=1309..1318 +x=442, y=1896..1912 +x=520, y=1765..1778 +x=497, y=1296..1298 +y=1233, x=620..630 +y=1296, x=494..497 +y=1447, x=580..641 +x=659, y=1709..1710 +x=615, y=1507..1533 +x=564, y=726..730 +x=462, y=685..698 +x=640, y=1075..1093 +x=632, y=1647..1659 +x=576, y=476..490 +x=482, y=327..334 +x=559, y=569..587 +y=345, x=557..580 +x=656, y=851..868 +x=456, y=1830..1837 +x=607, y=1773..1789 +y=755, x=442..458 +y=101, x=530..550 +x=561, y=939..950 +y=1744, x=554..575 +y=1567, x=635..663 +x=556, y=894..898 +y=1525, x=554..556 +x=655, y=1076..1093 +y=1618, x=490..497 +x=442, y=571..582 +x=649, y=1694..1703 +y=1453, x=441..449 +y=1575, x=527..530 +y=1843, x=445..471 +x=512, y=1811..1823 +y=650, x=438..450 +x=434, y=954..975 +x=662, y=223..247 +x=472, y=1511..1519 +x=568, y=556..559 +x=453, y=992..1001 +y=398, x=531..542 +x=619, y=1550..1552 +x=561, y=1421..1437 +y=337, x=477..499 +y=44, x=494..514 +x=457, y=208..230 +x=511, y=701..713 +x=620, y=1232..1233 +y=1146, x=632..646 +y=1872, x=435..454 +x=451, y=834..840 +x=565, y=142..164 +y=419, x=543..545 +y=1875, x=569..592 +y=1552, x=619..631 +x=490, y=1595..1618 +x=578, y=1777..1803 +x=543, y=434..462 +y=113, x=515..542 +y=1350, x=442..444 +y=963, x=609..624 +x=587, y=398..419 +y=1572, x=527..530 +x=501, y=966..983 +x=563, y=220..222 +x=566, y=1177..1187 +x=429, y=289..294 +y=972, x=554..573 +x=554, y=1323..1336 +x=584, y=1360..1373 +y=419, x=587..605 +x=565, y=1610..1622 +x=486, y=1810..1825 +y=1571, x=483..500 +y=30, x=446..463 +x=512, y=656..666 +y=1599, x=477..483 +x=530, y=1657..1662 +y=138, x=454..474 +y=1773, x=428..444 +y=1619, x=528..536 +x=486, y=1154..1156 +x=550, y=92..101 +y=1581, x=514..537 +y=440, x=488..512 +x=634, y=809..821 +x=599, y=1401..1409 +y=1222, x=576..579 +x=552, y=413..424 +y=265, x=619..640 +x=599, y=951..974 +x=504, y=496..521 +x=532, y=985..1012 +x=508, y=1189..1200 +y=188, x=525..551 +y=727, x=542..552 +x=631, y=1873..1875 +y=638, x=599..616 +x=556, y=1498..1511 +y=1292, x=620..625 +x=513, y=167..180 +y=1912, x=442..453 +x=531, y=82..87 +x=589, y=651..652 +x=637, y=1892..1908 +x=560, y=435..462 +y=411, x=559..574 +y=416, x=487..490 +y=1542, x=493..498 +x=602, y=1195..1207 +x=573, y=708..712 +x=575, y=1370..1395 +y=1480, x=643..645 +x=489, y=664..673 +x=428, y=1116..1124 +x=651, y=1152..1170 +x=625, y=1319..1331 +y=45, x=657..665 +x=453, y=325..335 +y=760, x=569..583 +x=628, y=1047..1058 +x=530, y=769..779 +y=842, x=455..463 +x=596, y=1669..1679 +x=571, y=1456..1464 +x=448, y=1667..1673 +x=648, y=29..31 +y=868, x=573..581 +y=1207, x=586..602 +y=1758, x=447..475 +x=444, y=1516..1531 +y=1303, x=489..505 +x=567, y=1404..1411 +y=689, x=531..552 +y=182, x=439..456 +x=570, y=861..864 +y=1012, x=532..541 +x=608, y=920..938 +y=563, x=547..575 +x=525, y=450..461 +y=1232, x=542..546 +x=539, y=1023..1035 +x=480, y=1689..1695 +y=191, x=633..638 +x=548, y=1437..1455 +y=1243, x=590..592 +x=431, y=1330..1348 +y=1053, x=552..567 +x=594, y=1693..1695 +x=479, y=787..789 +x=567, y=1654..1659 +y=902, x=524..528 +y=98, x=577..580 +x=554, y=253..263 +x=609, y=1856..1860 +y=203, x=488..503 +x=527, y=918..929 +x=607, y=901..915 +x=511, y=1905..1926 +y=436, x=498..503 +x=446, y=1224..1236 +x=580, y=131..142 +x=663, y=1708..1710 +x=512, y=1138..1145 +x=529, y=508..518 +y=298, x=605..613 +y=1867, x=524..542 diff --git a/2018/day17.py b/2018/day17.py new file mode 100644 index 0000000..6cb9c31 --- /dev/null +++ b/2018/day17.py @@ -0,0 +1,88 @@ +with open('day17-input', 'r') as file: + data = [l.strip('\n') for l in file] +import numpy as np +import re + +# numbers = [[int(s) for s in re.findall(r'-?\d+', d)] for d in data] +Xmin = [int(re.findall(r'x=(\d+)', d)[0]) for d in data] +Xmax = [int(re.findall(r'x=(?:\d+\.\.)?(\d+)', d)[0]) for d in data] +Ymin = [int(re.findall(r'y=(\d+)', d)[0]) for d in data] +Ymax = [int(re.findall(r'y=(?:\d+\.\.)?(\d+)', d)[0]) for d in data] + +# arr = np.array(numbers, dtype=np.int64) +# +# # x, y_start, y_end +# +y_min = min(Ymin) +y_max = max(Ymax) + +x_max = 700 + +init_grid = np.zeros((x_max, y_max), dtype=np.int64) # 0 = Sand, 1 = Clay, 2 = water +spring = [500, 0] + +for xmin, xmax, ymin, ymax in zip(Xmin, Xmax, Ymin, Ymax): + init_grid[xmin:xmax+1, ymin:ymax+1] = 1 + +grid = init_grid.copy() + +def drop_water(source=spring): + x, y = source + print('Dropping water from', source) + surface = grid[x, y:].argmax() + if surface == 0: + return False + # raise ValueError('Out of bounds') + surface_y = surface + y - 1 + # Find walls left and right + wall_left = (grid[x:0:-1, surface_y] > 0).argmax() + wall_right = (grid[x:, surface_y] > 0).argmax() + if wall_left: + left_x = x - wall_left + 1 + cliff = (grid[x:left_x-1:-1, surface_y + 1] == 0).argmax() + if cliff: + print('Found left wall but cliff present') + wall_left = False + if wall_right: + right_x = x + wall_right #- 1 + cliff = (grid[x:right_x, surface_y+1] == 0).argmax() + if cliff: + print('Found right wall but cliff present') + wall_right = False + + if wall_right and wall_left: + # Fill level of basin + grid[left_x:right_x, surface_y] = 2 + return True + sub_returns = False + if not wall_left: + cliff = (grid[x:0:-1, surface_y+1] == 0).argmax() + if cliff: + # Drop off the left + sub_returns |= drop_water((x - cliff, surface_y)) + if not wall_right: + cliff = (grid[x:, surface_y+1] == 0).argmax() + if cliff: + # Drop off the right + sub_returns |= drop_water((x + cliff, surface_y)) + + return sub_returns + + + +def visualize(): + vis_rows = [] + for row in range(y_max): + vis_rows.append(''.join([('.', '#', '~')[grid[col, row]] for col in range(x_max)])) + + with open('day17-vis', 'w') as file: + file.write('\n'.join(vis_rows)) + +# arr is all clay shelves + +# drop_water((502, 35)) + + +# 14572 low +# 15414 low +# 23233 low ??????