From f0f3f60ddd5a2b1b130c3ff4bb9e602382ebbaf2 Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Fri, 21 Dec 2018 13:37:02 +0000 Subject: [PATCH] Day 17 done --- advent-of-code.cabal | 9 + data/advent17-small.txt | 8 + data/advent17-test.txt | 10 + data/advent17.txt | 1770 ++++++++++++++++++++++++++++++++++++++ problems/day17.html | 258 ++++++ src/advent17/advent17.hs | 244 ++++++ 6 files changed, 2299 insertions(+) create mode 100644 data/advent17-small.txt create mode 100644 data/advent17-test.txt create mode 100644 data/advent17.txt create mode 100644 problems/day17.html create mode 100644 src/advent17/advent17.hs diff --git a/advent-of-code.cabal b/advent-of-code.cabal index 5e334e9..22868e7 100644 --- a/advent-of-code.cabal +++ b/advent-of-code.cabal @@ -199,3 +199,12 @@ executable advent16 , text , megaparsec , containers + +executable advent17 + hs-source-dirs: src/advent17 + main-is: advent17.hs + default-language: Haskell2010 + build-depends: base >= 4.7 && < 5 + , text + , megaparsec + , containers diff --git a/data/advent17-small.txt b/data/advent17-small.txt new file mode 100644 index 0000000..293b5af --- /dev/null +++ b/data/advent17-small.txt @@ -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 diff --git a/data/advent17-test.txt b/data/advent17-test.txt new file mode 100644 index 0000000..3e97806 --- /dev/null +++ b/data/advent17-test.txt @@ -0,0 +1,10 @@ +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 +y=2, x=500..502 +y=11, x=500..502 diff --git a/data/advent17.txt b/data/advent17.txt new file mode 100644 index 0000000..519d10b --- /dev/null +++ b/data/advent17.txt @@ -0,0 +1,1770 @@ +x=399, y=453..458 +x=557, y=590..599 +y=1182, x=364..369 +x=435, y=309..332 +y=15, x=463..487 +x=403, y=975..1001 +x=489, y=406..417 +x=421, y=266..272 +x=538, y=1549..1550 +y=1754, x=525..550 +y=335, x=544..551 +x=351, y=1176..1186 +x=452, y=1043..1045 +x=482, y=27..37 +x=422, y=787..812 +y=971, x=514..520 +x=476, y=30..42 +x=540, y=264..280 +x=501, y=424..433 +y=1204, x=317..322 +y=1714, x=324..327 +y=810, x=373..391 +y=1836, x=318..337 +y=454, x=466..468 +x=490, y=1027..1048 +x=367, y=1048..1056 +y=1486, x=442..447 +x=318, y=1829..1836 +y=690, x=351..376 +y=1632, x=296..312 +x=444, y=454..465 +x=523, y=546..556 +x=341, y=466..472 +y=1648, x=347..352 +y=1260, x=553..562 +x=340, y=1025..1036 +x=376, y=1008..1019 +x=390, y=976..1001 +x=498, y=855..857 +x=342, y=121..134 +x=546, y=19..28 +x=564, y=701..715 +x=364, y=649..652 +x=498, y=1182..1192 +x=429, y=1283..1301 +y=1371, x=438..440 +y=177, x=396..406 +x=453, y=252..257 +x=432, y=919..947 +x=328, y=1333..1346 +x=335, y=953..959 +x=358, y=1285..1288 +x=440, y=1368..1371 +y=594, x=343..350 +x=365, y=1279..1292 +x=519, y=1366..1380 +y=201, x=330..335 +x=418, y=1627..1632 +x=419, y=120..132 +y=1311, x=340..346 +x=506, y=1239..1243 +x=505, y=916..922 +y=1545, x=301..303 +x=553, y=564..573 +x=542, y=1828..1830 +x=347, y=1265..1268 +x=340, y=1336..1341 +x=505, y=876..896 +x=503, y=424..433 +x=356, y=1555..1568 +x=400, y=235..257 +x=562, y=1035..1062 +x=339, y=146..157 +y=890, x=356..374 +y=1281, x=329..331 +x=521, y=187..199 +y=328, x=469..471 +x=520, y=967..971 +x=438, y=1698..1723 +x=408, y=4..6 +y=1691, x=347..351 +y=773, x=382..387 +x=344, y=942..954 +x=544, y=924..941 +x=485, y=293..315 +y=671, x=386..388 +y=452, x=426..430 +y=1074, x=535..544 +y=1135, x=512..525 +x=386, y=669..671 +x=511, y=366..378 +y=1203, x=355..358 +y=740, x=510..532 +x=386, y=1049..1056 +y=127, x=492..498 +x=356, y=801..812 +y=536, x=431..539 +x=398, y=416..418 +y=1224, x=358..374 +x=365, y=178..188 +y=613, x=424..441 +x=438, y=497..518 +x=341, y=1176..1200 +y=266, x=519..535 +y=355, x=513..532 +y=141, x=535..548 +x=349, y=799..809 +x=380, y=586..600 +y=915, x=414..424 +x=303, y=1521..1545 +x=497, y=173..175 +y=1498, x=408..418 +x=298, y=977..989 +y=857, x=484..498 +x=395, y=1827..1837 +y=1374, x=335..354 +x=295, y=579..581 +y=808, x=290..293 +y=336, x=492..496 +x=440, y=1836..1839 +y=1585, x=553..557 +y=1182, x=396..398 +y=188, x=365..371 +y=1647, x=367..371 +x=403, y=1762..1773 +y=1184, x=507..509 +x=329, y=781..801 +x=317, y=1050..1067 +x=360, y=1511..1524 +y=1137, x=370..373 +x=340, y=889..891 +x=341, y=284..306 +y=518, x=433..438 +y=488, x=417..444 +x=301, y=281..293 +x=395, y=481..483 +x=431, y=380..386 +x=337, y=1258..1271 +x=483, y=1777..1790 +y=135, x=363..366 +y=1397, x=442..470 +x=366, y=30..32 +x=406, y=1708..1727 +y=1834, x=400..405 +x=371, y=179..188 +x=543, y=744..769 +x=481, y=1231..1241 +x=312, y=1601..1611 +y=1676, x=312..337 +y=687, x=301..305 +y=1422, x=502..504 +x=383, y=1497..1500 +x=318, y=1526..1548 +x=441, y=1698..1723 +y=328, x=376..397 +x=479, y=292..315 +y=551, x=385..396 +x=296, y=490..503 +x=510, y=1346..1358 +x=522, y=1653..1679 +x=513, y=185..196 +y=1473, x=468..472 +x=535, y=1338..1355 +x=422, y=120..132 +y=1825, x=417..428 +x=550, y=1434..1457 +x=382, y=770..773 +y=1766, x=533..537 +x=532, y=341..355 +x=364, y=30..32 +y=806, x=444..458 +x=348, y=942..954 +x=383, y=321..323 +x=543, y=265..280 +y=1861, x=307..324 +x=349, y=840..849 +x=418, y=1526..1535 +x=364, y=1003..1024 +y=969, x=423..440 +x=429, y=549..556 +y=103, x=492..494 +x=454, y=681..695 +y=634, x=413..430 +x=488, y=1171..1180 +y=579, x=337..350 +y=476, x=467..520 +y=954, x=344..348 +y=1329, x=361..368 +y=1481, x=316..336 +y=1641, x=532..536 +x=337, y=1666..1676 +x=304, y=178..182 +x=292, y=1374..1383 +x=535, y=254..266 +x=368, y=779..788 +x=424, y=1365..1377 +x=287, y=847..848 +x=528, y=252..263 +y=451, x=479..495 +x=387, y=1648..1650 +y=1165, x=362..381 +x=373, y=1125..1137 +y=801, x=316..329 +x=531, y=1858..1874 +x=365, y=1302..1314 +x=370, y=65..75 +y=1465, x=421..430 +y=1355, x=354..374 +x=475, y=910..923 +y=1004, x=504..507 +y=412, x=301..307 +x=398, y=1608..1624 +x=351, y=703..704 +x=531, y=781..789 +x=524, y=441..464 +x=472, y=815..818 +x=451, y=396..418 +x=356, y=345..351 +y=1339, x=380..402 +x=504, y=989..1004 +x=302, y=1565..1589 +y=1309, x=340..346 +x=325, y=27..29 +x=545, y=945..963 +x=310, y=433..438 +x=483, y=1821..1830 +x=463, y=1316..1319 +y=307, x=501..503 +y=232, x=437..453 +x=322, y=1077..1094 +x=404, y=397..422 +y=151, x=501..506 +x=430, y=1106..1109 +y=1438, x=445..463 +y=138, x=358..375 +x=522, y=130..133 +x=350, y=1558..1564 +x=431, y=1865..1875 +y=930, x=461..483 +x=387, y=950..965 +x=463, y=1426..1438 +x=479, y=1564..1586 +x=541, y=502..518 +x=331, y=78..101 +x=393, y=144..172 +y=769, x=410..434 +y=1168, x=502..520 +x=399, y=1209..1231 +x=396, y=157..177 +x=318, y=1337..1343 +y=1380, x=519..522 +x=501, y=829..848 +y=382, x=303..328 +x=437, y=1211..1227 +y=1314, x=365..382 +x=335, y=1363..1374 +x=494, y=916..922 +y=1211, x=461..484 +y=278, x=451..462 +y=1095, x=353..371 +x=310, y=761..770 +x=343, y=1106..1119 +y=1067, x=311..317 +x=364, y=66..75 +x=440, y=1867..1880 +y=1196, x=292..294 +y=418, x=391..398 +x=434, y=92..102 +x=514, y=489..491 +x=486, y=117..131 +x=498, y=386..396 +x=454, y=301..303 +x=292, y=1170..1196 +x=359, y=1241..1266 +x=535, y=123..141 +x=504, y=1239..1243 +y=1589, x=290..302 +y=707, x=287..300 +x=431, y=963..965 +x=402, y=863..866 +x=390, y=1060..1088 +x=380, y=234..257 +x=307, y=927..936 +y=1671, x=449..472 +x=484, y=721..746 +x=537, y=799..806 +x=338, y=945..957 +y=788, x=458..475 +x=324, y=952..959 +x=500, y=73..84 +x=553, y=67..76 +x=561, y=15..27 +x=367, y=145..172 +y=1771, x=533..537 +y=1292, x=345..365 +x=490, y=529..532 +x=393, y=1292..1293 +x=521, y=279..282 +y=1311, x=371..375 +x=345, y=968..979 +x=350, y=589..594 +x=504, y=118..131 +y=1227, x=437..452 +y=1696, x=496..508 +x=358, y=1192..1203 +x=552, y=639..651 +x=370, y=685..687 +x=343, y=1381..1405 +x=551, y=745..769 +y=1604, x=407..412 +y=10, x=478..480 +x=413, y=1647..1650 +x=393, y=1812..1814 +y=1094, x=322..327 +x=520, y=462..476 +y=1271, x=337..354 +x=501, y=320..331 +x=527, y=1308..1332 +y=898, x=532..534 +x=319, y=1552..1564 +x=492, y=1262..1279 +x=549, y=1224..1233 +y=1567, x=305..325 +x=487, y=4..15 +x=395, y=1419..1441 +x=403, y=568..577 +x=347, y=1635..1648 +y=812, x=422..425 +x=304, y=1490..1502 +x=484, y=574..600 +x=488, y=1430..1445 +y=375, x=522..524 +x=536, y=1635..1641 +y=189, x=412..421 +x=345, y=345..351 +x=470, y=1121..1128 +y=634, x=499..516 +x=368, y=216..228 +x=545, y=1484..1491 +x=521, y=385..396 +x=431, y=736..748 +y=1686, x=364..389 +x=368, y=1321..1329 +y=916, x=382..401 +y=310, x=492..509 +y=812, x=337..356 +x=450, y=79..106 +x=338, y=1748..1757 +x=358, y=1850..1862 +x=531, y=591..615 +y=1484, x=460..475 +x=448, y=296..306 +y=1757, x=319..338 +y=237, x=404..432 +x=393, y=1784..1795 +y=26, x=531..538 +x=356, y=1324..1336 +x=464, y=831..839 +x=517, y=279..282 +y=610, x=433..435 +y=1036, x=322..340 +y=1355, x=535..562 +y=1288, x=352..358 +x=400, y=1832..1834 +y=115, x=537..539 +y=1366, x=314..323 +x=346, y=1384..1397 +x=503, y=298..307 +x=380, y=1330..1339 +x=367, y=1643..1647 +x=532, y=442..464 +x=439, y=936..943 +y=263, x=525..528 +x=299, y=1337..1343 +x=294, y=51..66 +x=539, y=1309..1332 +x=324, y=1840..1861 +x=555, y=1035..1062 +x=435, y=275..289 +x=477, y=403..419 +y=1170, x=530..535 +y=199, x=330..335 +x=533, y=1485..1491 +x=341, y=1452..1458 +y=1668, x=405..411 +x=413, y=33..42 +y=1874, x=522..531 +x=397, y=481..483 +x=296, y=1749..1757 +x=380, y=103..114 +x=371, y=1300..1311 +x=352, y=840..849 +x=442, y=166..190 +y=256, x=288..316 +x=504, y=1422..1425 +x=323, y=649..669 +x=471, y=1777..1790 +x=416, y=589..591 +y=323, x=383..389 +x=414, y=440..455 +x=330, y=199..201 +x=337, y=554..579 +x=541, y=858..869 +x=428, y=736..748 +x=458, y=777..788 +y=1397, x=346..365 +x=333, y=1706..1718 +x=294, y=960..966 +y=83, x=289..310 +x=326, y=986..999 +x=299, y=106..126 +y=1521, x=403..421 +x=473, y=1121..1128 +x=394, y=1210..1231 +y=937, x=323..338 +x=515, y=1413..1429 +y=839, x=464..474 +y=418, x=451..473 +x=555, y=331..358 +x=560, y=619..623 +y=245, x=500..519 +x=354, y=1259..1271 +y=1880, x=424..440 +x=361, y=1341..1350 +x=331, y=616..639 +y=1790, x=471..483 +x=429, y=891..910 +y=1483, x=553..558 +x=363, y=1733..1739 +x=357, y=1684..1696 +x=384, y=287..307 +x=478, y=10..12 +x=409, y=969..985 +x=329, y=1235..1248 +y=1109, x=426..430 +x=538, y=15..26 +x=349, y=1195..1206 +x=371, y=1085..1095 +y=1591, x=349..364 +y=1508, x=499..506 +x=553, y=1578..1585 +y=458, x=399..405 +x=519, y=231..245 +x=333, y=1385..1387 +x=293, y=797..808 +y=1146, x=293..299 +x=377, y=389..400 +x=325, y=1535..1546 +y=1138, x=300..311 +x=373, y=1609..1624 +x=424, y=1868..1880 +x=458, y=1639..1653 +x=355, y=239..254 +y=126, x=296..299 +x=342, y=741..757 +y=1520, x=469..493 +x=534, y=1828..1830 +y=304, x=544..548 +x=398, y=1041..1049 +y=182, x=297..304 +y=965, x=387..396 +x=349, y=1580..1591 +x=493, y=543..568 +x=540, y=1285..1300 +x=474, y=231..237 +x=348, y=1618..1630 +y=301, x=454..457 +x=380, y=287..307 +x=479, y=1317..1319 +x=407, y=62..79 +y=1318, x=492..511 +y=496, x=484..498 +y=652, x=361..364 +x=397, y=662..674 +x=447, y=151..152 +x=385, y=545..551 +x=463, y=1105..1109 +x=544, y=1049..1074 +x=364, y=1579..1591 +x=539, y=112..115 +y=1596, x=483..510 +x=496, y=330..336 +y=706, x=489..540 +y=1358, x=494..510 +x=322, y=1024..1036 +x=524, y=364..375 +y=1119, x=343..364 +x=452, y=165..190 +x=535, y=1150..1170 +y=1524, x=442..463 +x=452, y=40..54 +y=378, x=511..530 +x=460, y=1328..1333 +x=363, y=1428..1439 +x=452, y=483..493 +x=447, y=1366..1377 +x=426, y=1060..1087 +x=363, y=133..135 +y=1334, x=421..438 +x=360, y=720..731 +x=491, y=1414..1429 +x=366, y=1710..1719 +y=999, x=428..452 +y=493, x=452..475 +x=523, y=798..806 +x=522, y=364..375 +x=369, y=702..715 +x=468, y=1811..1831 +y=1672, x=346..351 +x=317, y=882..898 +y=432, x=330..356 +x=312, y=1666..1676 +y=1630, x=348..369 +x=375, y=1063..1075 +x=369, y=294..301 +y=1186, x=351..375 +x=450, y=1755..1763 +x=350, y=496..523 +x=516, y=629..634 +y=428, x=512..536 +y=516, x=444..530 +x=542, y=20..28 +x=330, y=1129..1152 +x=483, y=765..767 +x=355, y=1064..1075 +y=1056, x=367..386 +x=435, y=1160..1170 +x=355, y=398..405 +y=1491, x=533..545 +y=1019, x=376..396 +y=591, x=409..416 +y=568, x=493..506 +x=336, y=1469..1481 +x=492, y=49..63 +y=230, x=409..426 +x=358, y=1637..1651 +y=1420, x=297..310 +x=444, y=502..516 +y=152, x=434..447 +x=438, y=1368..1371 +x=494, y=1347..1358 +x=451, y=1106..1109 +y=1192, x=389..404 +x=417, y=395..399 +y=1853, x=497..520 +x=324, y=316..332 +y=68, x=469..488 +y=1350, x=361..366 +y=1629, x=304..306 +y=684, x=287..291 +y=455, x=414..440 +x=290, y=1564..1589 +x=452, y=1210..1227 +x=432, y=32..42 +y=1817, x=287..402 +x=356, y=419..432 +y=1841, x=343..368 +y=1088, x=390..401 +x=513, y=125..136 +y=693, x=396..402 +y=1336, x=337..340 +x=320, y=1688..1697 +y=1040, x=358..384 +x=442, y=1392..1397 +y=523, x=350..354 +x=401, y=750..760 +x=314, y=1401..1403 +y=417, x=489..507 +x=393, y=93..104 +y=1452, x=341..343 +x=343, y=1710..1719 +x=335, y=199..201 +x=528, y=1512..1538 +x=426, y=230..233 +x=512, y=1112..1135 +y=1055, x=333..355 +x=344, y=26..29 +x=486, y=95..107 +x=296, y=106..126 +y=1757, x=296..305 +x=492, y=143..156 +y=497, x=303..306 +x=366, y=133..135 +y=445, x=486..488 +x=444, y=1323..1336 +y=947, x=419..432 +x=372, y=295..301 +x=311, y=1049..1067 +y=75, x=364..370 +y=848, x=287..308 +x=358, y=744..756 +y=172, x=367..393 +x=474, y=831..839 +x=344, y=1129..1152 +x=544, y=297..304 +y=1727, x=403..406 +x=404, y=1164..1192 +x=400, y=863..866 +y=208, x=474..478 +y=1831, x=465..468 +x=465, y=296..306 +x=330, y=285..306 +x=426, y=92..102 +x=402, y=1805..1817 +x=321, y=1382..1405 +y=1341, x=337..340 +y=1723, x=438..441 +x=305, y=1748..1757 +x=355, y=944..957 +x=445, y=1427..1438 +x=409, y=589..591 +y=1421, x=337..353 +y=448, x=486..488 +x=449, y=1185..1190 +x=539, y=526..536 +x=299, y=1144..1146 +y=746, x=484..500 +x=361, y=605..614 +x=314, y=1006..1017 +y=289, x=433..435 +x=520, y=924..940 +x=314, y=142..162 +x=405, y=1059..1087 +x=480, y=166..178 +x=330, y=1022..1031 +x=475, y=1329..1333 +y=1763, x=450..468 +x=493, y=1226..1249 +x=300, y=1118..1138 +x=421, y=1519..1521 +x=478, y=203..208 +y=6, x=380..408 +x=504, y=47..59 +x=543, y=894..907 +x=407, y=1583..1604 +x=481, y=1715..1716 +y=438, x=287..310 +x=331, y=1669..1672 +x=466, y=405..410 +x=530, y=99..118 +x=431, y=549..556 +y=560, x=417..437 +x=326, y=1385..1387 +x=518, y=488..491 +y=1368, x=438..440 +x=343, y=1429..1439 +y=42, x=413..432 +x=387, y=770..773 +y=693, x=527..539 +x=442, y=1503..1524 +x=403, y=1520..1521 +y=468, x=361..363 +x=520, y=1761..1774 +y=1170, x=412..435 +y=1025, x=519..528 +y=1568, x=342..356 +x=493, y=875..896 +x=375, y=120..138 +x=389, y=93..104 +x=323, y=188..208 +x=407, y=1789..1791 +y=818, x=472..480 +x=354, y=1364..1374 +y=1249, x=493..512 +y=457, x=457..474 +y=1233, x=539..549 +x=443, y=251..257 +y=301, x=369..372 +y=1048, x=442..467 +x=553, y=1245..1260 +x=309, y=1273..1280 +y=873, x=449..460 +x=424, y=1095..1101 +y=1550, x=516..538 +x=534, y=898..903 +x=488, y=64..68 +x=374, y=863..890 +x=520, y=1851..1853 +x=469, y=1196..1206 +y=1871, x=337..349 +x=301, y=1521..1545 +y=416, x=391..398 +x=426, y=381..386 +y=957, x=338..355 +x=492, y=12..22 +y=936, x=298..307 +x=340, y=1309..1311 +x=405, y=1661..1668 +y=532, x=490..516 +y=989, x=298..317 +x=471, y=327..328 +x=292, y=175..189 +y=979, x=328..345 +x=298, y=18..32 +x=390, y=1291..1293 +x=490, y=427..436 +x=502, y=1422..1425 +x=337, y=984..995 +y=1043, x=452..460 +x=431, y=1192..1208 +y=54, x=452..464 +x=511, y=50..63 +y=1718, x=308..333 +y=1383, x=292..311 +x=311, y=1373..1383 +y=118, x=530..545 +y=27, x=555..561 +x=323, y=1644..1657 +x=424, y=585..595 +x=374, y=640..655 +y=132, x=419..422 +x=527, y=684..693 +x=421, y=1534..1544 +x=492, y=300..310 +y=1127, x=413..439 +x=550, y=1726..1754 +x=459, y=832..841 +x=449, y=866..873 +x=521, y=321..331 +x=558, y=1459..1483 +x=287, y=433..438 +x=505, y=188..199 +x=545, y=1433..1457 +x=365, y=1383..1397 +x=412, y=258..276 +x=380, y=662..674 +y=1719, x=343..366 +x=412, y=1628..1632 +x=403, y=1707..1727 +x=551, y=564..573 +x=465, y=1001..1026 +x=319, y=535..554 +y=102, x=426..434 +y=669, x=305..323 +x=397, y=317..328 +x=390, y=1419..1441 +x=489, y=1328..1332 +y=29, x=325..344 +y=556, x=523..541 +x=533, y=1766..1771 +x=555, y=923..941 +y=303, x=454..457 +y=1564, x=348..350 +x=433, y=496..518 +x=389, y=1165..1192 +x=375, y=1150..1161 +x=366, y=1061..1072 +x=545, y=1570..1592 +x=292, y=961..966 +x=348, y=1558..1564 +y=841, x=452..459 +y=1791, x=400..407 +x=298, y=1687..1697 +y=1586, x=474..479 +x=403, y=1238..1250 +y=735, x=353..369 +x=504, y=1273..1281 +x=328, y=1784..1789 +y=104, x=389..393 +y=1439, x=343..363 +x=505, y=167..178 +y=101, x=331..355 +x=540, y=706..708 +y=687, x=368..370 +x=499, y=1497..1508 +y=553, x=530..535 +x=486, y=261..276 +y=1293, x=499..522 +x=330, y=1427..1439 +x=435, y=601..610 +y=114, x=376..380 +x=492, y=973..981 +x=292, y=1413..1428 +x=311, y=50..66 +y=305, x=345..350 +x=431, y=1095..1101 +x=385, y=523..531 +y=573, x=551..553 +x=532, y=725..740 +y=1075, x=355..375 +x=343, y=822..833 +x=437, y=546..560 +x=467, y=1230..1241 +x=447, y=1601..1609 +x=371, y=1643..1647 +y=1548, x=316..318 +y=280, x=540..543 +y=223, x=494..517 +x=522, y=1367..1380 +y=1458, x=341..343 +y=1830, x=483..491 +x=475, y=854..880 +y=791, x=356..376 +x=337, y=1336..1341 +x=417, y=546..560 +x=421, y=1463..1465 +x=365, y=1083..1092 +y=1774, x=520..547 +x=520, y=1163..1168 +x=439, y=1119..1127 +x=460, y=1477..1484 +x=328, y=379..382 +y=685, x=368..370 +y=1540, x=462..466 +y=623, x=548..560 +x=509, y=426..436 +x=363, y=337..355 +y=37, x=482..484 +x=429, y=1755..1772 +x=444, y=801..806 +x=530, y=367..378 +x=509, y=1804..1826 +x=514, y=968..971 +y=1134, x=403..408 +x=408, y=682..696 +x=417, y=1819..1825 +x=455, y=1139..1147 +x=519, y=255..266 +x=323, y=215..235 +y=1860, x=404..424 +x=434, y=1687..1701 +x=477, y=78..106 +x=416, y=1850..1853 +y=1104, x=530..538 +x=412, y=1582..1604 +x=305, y=1555..1567 +x=326, y=529..539 +x=427, y=341..349 +x=306, y=495..497 +y=307, x=380..384 +x=337, y=905..913 +x=394, y=848..850 +y=131, x=486..504 +x=329, y=1281..1284 +y=358, x=555..560 +y=1739, x=363..387 +x=507, y=1070..1083 +x=305, y=675..687 +x=312, y=1552..1564 +x=480, y=72..84 +y=239, x=508..511 +x=522, y=1859..1874 +x=468, y=680..695 +y=32, x=298..304 +x=313, y=87..106 +x=365, y=1194..1206 +y=1243, x=504..506 +x=323, y=927..937 +x=515, y=185..196 +x=458, y=801..806 +y=770, x=382..387 +x=484, y=27..37 +x=341, y=863..875 +y=1672, x=327..331 +y=174, x=542..553 +y=1336, x=356..374 +y=1650, x=387..413 +y=396, x=498..521 +y=72, x=398..401 +x=401, y=1061..1088 +y=875, x=321..341 +x=460, y=865..873 +y=410, x=464..466 +x=327, y=1669..1672 +x=294, y=1169..1196 +x=494, y=92..103 +x=331, y=908..919 +y=1394, x=351..357 +y=1648, x=523..544 +x=529, y=124..136 +y=1206, x=349..365 +y=1538, x=528..537 +x=366, y=1341..1350 +y=903, x=532..534 +x=402, y=585..595 +x=351, y=146..157 +x=412, y=1161..1170 +x=375, y=1176..1186 +x=526, y=1570..1592 +x=512, y=1273..1281 +x=424, y=683..693 +x=466, y=854..880 +y=1736, x=328..347 +x=501, y=298..307 +y=1853, x=412..416 +y=491, x=514..518 +x=328, y=1448..1461 +x=504, y=1397..1399 +x=396, y=951..965 +x=472, y=1459..1473 +x=530, y=276..289 +y=405, x=342..355 +x=453, y=1323..1336 +x=369, y=1659..1670 +x=535, y=544..553 +x=467, y=462..476 +y=809, x=345..349 +x=388, y=639..651 +x=445, y=342..349 +y=966, x=292..294 +x=449, y=1666..1671 +x=541, y=547..556 +x=384, y=744..756 +x=454, y=1530..1544 +x=536, y=410..428 +y=581, x=295..322 +x=500, y=1438..1465 +x=511, y=229..239 +y=1231, x=394..399 +x=498, y=115..127 +x=287, y=691..707 +x=539, y=1225..1233 +y=668, x=528..538 +x=390, y=750..760 +x=374, y=990..997 +x=343, y=1832..1841 +y=1564, x=312..319 +y=349, x=427..445 +x=452, y=991..999 +x=365, y=239..254 +y=133, x=363..366 +y=1650, x=494..497 +x=352, y=455..477 +y=674, x=380..397 +x=471, y=1836..1838 +x=514, y=1439..1465 +x=322, y=1185..1204 +y=1632, x=412..418 +x=444, y=683..693 +x=420, y=570..580 +y=293, x=301..323 +x=502, y=1163..1168 +y=731, x=358..360 +x=305, y=650..669 +y=963, x=528..545 +y=1701, x=406..434 +x=353, y=883..897 +x=333, y=702..704 +x=543, y=1801..1805 +x=456, y=1284..1301 +x=408, y=1472..1498 +x=362, y=1153..1165 +x=333, y=884..897 +y=196, x=513..515 +y=807, x=478..503 +x=348, y=1535..1546 +x=348, y=907..919 +y=891, x=340..342 +y=1332, x=527..539 +x=486, y=445..448 +y=503, x=296..312 +x=480, y=815..818 +x=544, y=1625..1648 +y=134, x=327..342 +x=527, y=590..615 +x=533, y=859..869 +y=450, x=426..430 +x=346, y=1309..1311 +x=342, y=87..95 +y=1289, x=315..337 +x=345, y=742..757 +y=985, x=406..409 +x=535, y=1577..1582 +y=1380, x=301..305 +x=308, y=1707..1718 +x=562, y=1246..1260 +y=639, x=331..350 +x=297, y=178..182 +x=391, y=416..418 +x=556, y=1801..1805 +x=317, y=1412..1428 +x=469, y=1515..1520 +x=403, y=1118..1134 +y=898, x=305..317 +x=509, y=277..289 +y=1657, x=300..323 +x=438, y=1315..1334 +x=405, y=1832..1834 +x=488, y=262..276 +y=235, x=315..323 +x=488, y=1847..1862 +x=396, y=1007..1019 +y=272, x=421..423 +x=341, y=1157..1170 +x=417, y=371..379 +x=331, y=860..871 +x=462, y=1534..1540 +x=358, y=1034..1040 +x=509, y=1184..1188 +y=190, x=442..452 +x=525, y=252..263 +x=479, y=403..419 +x=468, y=1754..1763 +y=704, x=333..351 +x=315, y=1276..1289 +x=460, y=1043..1045 +x=557, y=1579..1585 +y=1772, x=429..443 +x=492, y=115..127 +y=869, x=533..541 +y=923, x=475..477 +x=310, y=77..83 +x=375, y=1300..1311 +x=508, y=1680..1696 +x=399, y=586..600 +x=379, y=606..614 +y=1425, x=502..504 +x=466, y=1534..1540 +x=530, y=544..553 +x=442, y=1480..1486 +x=380, y=1127..1141 +x=531, y=15..26 +x=458, y=936..943 +y=919, x=331..348 +x=464, y=405..410 +x=471, y=1172..1180 +x=463, y=1074..1078 +x=369, y=1179..1182 +x=351, y=1390..1394 +x=495, y=441..451 +y=1141, x=364..380 +y=999, x=326..344 +y=228, x=368..381 +y=1862, x=358..362 +x=310, y=1420..1424 +x=368, y=1832..1841 +x=492, y=1312..1318 +y=1697, x=298..320 +y=289, x=509..530 +x=540, y=925..940 +x=483, y=830..848 +y=276, x=486..488 +y=922, x=494..505 +y=1837, x=395..414 +x=307, y=1839..1861 +y=1716, x=481..492 +x=361, y=1321..1329 +x=355, y=78..101 +x=291, y=680..684 +x=314, y=124..132 +x=426, y=450..452 +y=871, x=327..331 +y=1377, x=424..447 +x=358, y=1222..1224 +y=1465, x=500..514 +x=300, y=535..554 +x=433, y=601..610 +x=506, y=542..568 +y=1332, x=489..508 +x=487, y=1073..1078 +y=1789, x=318..328 +y=1248, x=329..346 +x=352, y=1285..1288 +y=1200, x=337..341 +x=363, y=461..468 +x=426, y=422..431 +x=316, y=782..801 +x=492, y=1714..1716 +y=257, x=443..453 +x=411, y=394..399 +x=474, y=1565..1586 +x=423, y=1254..1263 +x=408, y=1118..1134 +x=525, y=1727..1754 +x=382, y=908..916 +x=537, y=112..115 +y=806, x=523..537 +x=471, y=1196..1206 +y=1839, x=421..440 +x=528, y=662..668 +x=489, y=706..708 +y=756, x=358..384 +x=345, y=1279..1292 +x=521, y=10..24 +x=410, y=148..171 +y=106, x=450..477 +y=1143, x=479..494 +x=348, y=27..37 +x=336, y=1511..1524 +y=465, x=444..446 +x=509, y=1565..1580 +x=345, y=1491..1502 +x=463, y=5..15 +x=516, y=529..532 +x=349, y=467..472 +x=501, y=148..151 +y=1024, x=364..373 +y=1314, x=332..356 +x=493, y=1514..1520 +y=848, x=483..501 +x=361, y=461..468 +x=483, y=907..930 +x=293, y=1145..1146 +x=353, y=723..735 +x=538, y=663..668 +x=430, y=450..452 +x=506, y=1498..1508 +y=897, x=333..353 +x=343, y=1452..1458 +x=500, y=232..245 +x=430, y=1462..1465 +x=499, y=629..634 +x=442, y=1034..1048 +x=542, y=161..174 +y=1654, x=482..505 +x=356, y=863..890 +x=373, y=1004..1024 +x=396, y=544..551 +x=361, y=1497..1500 +y=22, x=492..514 +x=446, y=455..465 +x=317, y=88..106 +y=1500, x=361..383 +x=391, y=808..810 +y=531, x=385..405 +y=189, x=292..311 +x=468, y=1460..1473 +x=539, y=683..693 +x=376, y=316..328 +x=411, y=371..379 +x=404, y=1846..1860 +x=316, y=245..256 +x=316, y=1527..1548 +y=175, x=494..497 +x=342, y=889..891 +y=1387, x=326..333 +x=306, y=1617..1629 +y=157, x=339..351 +x=330, y=420..432 +y=1611, x=312..355 +x=345, y=799..809 +y=995, x=331..337 +x=423, y=149..171 +x=498, y=483..496 +x=494, y=1118..1143 +x=529, y=1812..1838 +x=484, y=484..496 +x=560, y=566..576 +y=1346, x=328..346 +x=421, y=1316..1334 +x=530, y=1653..1679 +x=352, y=1635..1648 +x=562, y=1337..1355 +x=384, y=1034..1040 +x=457, y=442..457 +x=321, y=862..875 +x=532, y=1635..1641 +x=484, y=856..857 +y=386, x=426..431 +x=364, y=536..562 +x=307, y=996..1015 +x=537, y=1577..1582 +x=419, y=919..947 +y=1445, x=479..488 +x=485, y=1262..1279 +y=112, x=537..539 +x=374, y=1323..1336 +x=298, y=928..936 +y=577, x=378..403 +y=87, x=342..349 +x=411, y=1310..1322 +x=398, y=68..72 +x=435, y=1534..1544 +y=79, x=391..407 +x=560, y=332..358 +x=531, y=1785..1788 +y=464, x=524..532 +y=1128, x=470..473 +x=359, y=842..853 +y=1109, x=451..463 +x=345, y=188..208 +x=451, y=261..278 +y=369, x=334..352 +x=402, y=685..693 +x=337, y=1277..1289 +x=518, y=142..156 +y=615, x=527..531 +x=500, y=1564..1580 +x=402, y=1329..1339 +x=324, y=1712..1714 +x=434, y=1610..1630 +y=32, x=364..366 +x=358, y=720..731 +y=769, x=543..551 +x=429, y=477..481 +x=534, y=1791..1796 +y=562, x=364..373 +y=655, x=356..374 +x=437, y=212..232 +x=339, y=1215..1227 +y=63, x=492..511 +x=519, y=1001..1025 +x=522, y=1270..1293 +x=510, y=1588..1596 +x=381, y=1152..1165 +y=913, x=337..342 +y=1192, x=498..519 +y=1630, x=434..440 +y=199, x=505..521 +x=337, y=1829..1836 +x=342, y=398..405 +x=296, y=1620..1632 +x=353, y=1409..1421 +x=370, y=1150..1161 +x=514, y=11..22 +x=342, y=647..670 +x=377, y=973..978 +x=479, y=441..451 +y=84, x=480..500 +x=301, y=1377..1380 +y=1273, x=504..512 +x=351, y=1681..1691 +y=997, x=352..374 +x=421, y=178..189 +x=472, y=1667..1671 +y=399, x=411..417 +y=279, x=517..521 +x=356, y=1476..1490 +y=431, x=426..436 +x=297, y=1762..1773 +y=95, x=342..349 +x=370, y=1125..1137 +x=342, y=1554..1568 +y=1190, x=443..449 +x=461, y=908..930 +x=440, y=1611..1630 +y=351, x=345..356 +x=537, y=1766..1771 +x=433, y=1865..1875 +y=748, x=428..431 +x=409, y=861..873 +x=512, y=1226..1249 +x=305, y=881..898 +x=346, y=1334..1346 +y=1696, x=337..357 +x=441, y=5..11 +x=530, y=502..516 +x=476, y=574..600 +y=1862, x=482..488 +x=358, y=121..138 +x=414, y=1827..1837 +x=459, y=232..237 +y=1300, x=540..549 +x=424, y=743..745 +x=431, y=526..536 +x=396, y=1168..1182 +x=354, y=497..523 +x=349, y=1864..1871 +x=417, y=1192..1208 +x=338, y=928..937 +x=412, y=934..944 +x=441, y=603..613 +x=357, y=1390..1394 +x=327, y=1077..1094 +y=1633, x=490..498 +y=331, x=501..521 +x=404, y=1527..1535 +y=276, x=412..429 +y=863, x=400..402 +x=393, y=860..873 +x=414, y=1784..1795 +y=1180, x=471..488 +x=549, y=1284..1300 +x=390, y=1660..1670 +x=380, y=5..6 +x=379, y=389..400 +y=321, x=383..389 +y=257, x=380..400 +x=324, y=1474..1476 +x=364, y=1107..1119 +x=456, y=891..910 +x=503, y=801..807 +x=538, y=381..385 +x=327, y=1712..1714 +x=398, y=1168..1182 +x=288, y=246..256 +y=1015, x=297..307 +y=1279, x=485..492 +y=1322, x=395..411 +x=365, y=1475..1490 +x=468, y=444..454 +x=364, y=1679..1686 +y=1429, x=491..515 +y=1161, x=370..375 +x=368, y=685..687 +x=314, y=1353..1366 +y=693, x=424..444 +x=463, y=1502..1524 +y=539, x=326..354 +x=303, y=379..382 +x=497, y=1850..1853 +y=1502, x=304..345 +x=383, y=397..422 +x=328, y=969..979 +x=409, y=230..233 +y=1461, x=328..354 +x=445, y=1836..1838 +y=849, x=349..352 +x=505, y=1637..1654 +x=475, y=483..493 +y=1266, x=359..365 +x=405, y=524..531 +x=440, y=957..969 +y=113, x=344..352 +x=535, y=1049..1074 +x=498, y=1613..1633 +x=538, y=1082..1104 +x=475, y=777..788 +y=11, x=441..453 +x=302, y=124..132 +y=66, x=294..311 +x=346, y=1235..1248 +x=317, y=976..989 +x=422, y=1648..1667 +x=389, y=1678..1686 +y=1343, x=299..318 +x=380, y=430..451 +x=297, y=1037..1061 +y=1795, x=393..414 +x=304, y=1617..1629 +y=1152, x=330..344 +x=436, y=423..431 +y=1263, x=423..443 +x=428, y=990..999 +y=577, x=429..433 +x=462, y=731..752 +x=470, y=1139..1147 +y=757, x=342..345 +y=1355, x=502..504 +x=413, y=622..634 +x=311, y=174..189 +x=427, y=477..481 +x=406, y=158..177 +x=433, y=568..577 +y=1582, x=535..537 +y=734, x=519..521 +x=521, y=729..734 +x=394, y=1559..1586 +y=1293, x=390..393 +y=614, x=361..379 +y=233, x=409..426 +x=400, y=1789..1791 +x=413, y=1241..1244 +x=548, y=619..623 +x=497, y=1642..1650 +x=345, y=1361..1371 +x=389, y=683..696 +x=528, y=1002..1025 +x=544, y=320..335 +y=695, x=454..468 +x=308, y=846..848 +y=355, x=340..363 +y=106, x=313..317 +x=421, y=847..850 +y=472, x=341..349 +x=506, y=148..151 +y=132, x=302..314 +y=306, x=448..465 +y=1147, x=455..470 +x=325, y=141..162 +x=322, y=580..581 +y=332, x=321..324 +x=350, y=615..639 +y=332, x=414..435 +x=289, y=77..83 +y=981, x=479..492 +x=376, y=680..690 +y=1048, x=490..504 +x=325, y=1554..1567 +x=337, y=1408..1421 +x=401, y=907..916 +y=518, x=541..557 +y=379, x=411..417 +x=304, y=19..32 +x=541, y=567..576 +x=453, y=212..232 +y=1796, x=511..534 +x=443, y=1756..1772 +x=434, y=150..152 +y=1609, x=447..466 +y=451, x=380..393 +x=428, y=1819..1825 +x=479, y=974..981 +y=556, x=429..431 +x=517, y=894..907 +y=1484, x=478..494 +y=481, x=427..429 +y=907, x=517..543 +y=483, x=395..397 +x=361, y=649..652 +y=208, x=323..345 +x=355, y=1601..1611 +x=432, y=210..237 +x=532, y=898..903 +x=327, y=122..134 +y=1490, x=356..365 +x=507, y=989..1004 +y=943, x=439..458 +x=474, y=441..457 +x=321, y=1474..1476 +x=353, y=1086..1095 +x=374, y=1344..1355 +y=37, x=348..374 +y=595, x=402..424 +y=1524, x=336..360 +y=1670, x=369..390 +y=770, x=297..310 +x=469, y=63..68 +x=297, y=1420..1424 +x=364, y=1128..1141 +x=519, y=1181..1192 +x=517, y=211..223 +x=341, y=843..853 +x=295, y=1400..1403 +x=464, y=40..54 +y=254, x=355..365 +x=507, y=1184..1188 +y=1371, x=345..348 +y=788, x=368..370 +x=502, y=1353..1355 +y=580, x=420..439 +y=461, x=361..363 +x=417, y=470..488 +y=12, x=478..480 +x=469, y=326..328 +x=338, y=1007..1017 +y=850, x=394..421 +x=352, y=365..369 +y=1405, x=321..343 +x=513, y=342..355 +y=315, x=479..485 +y=133, x=519..522 +x=494, y=1482..1484 +x=382, y=1303..1314 +y=1319, x=463..479 +y=433, x=501..503 +y=282, x=517..521 +y=419, x=477..479 +x=457, y=301..303 +x=289, y=1272..1280 +y=708, x=489..540 +x=365, y=1242..1266 +x=504, y=782..789 +y=1838, x=445..471 +y=599, x=557..562 +x=491, y=1820..1830 +x=393, y=430..451 +y=1592, x=526..545 +y=237, x=459..474 +x=396, y=742..745 +y=1773, x=297..403 +x=319, y=1158..1170 +y=1788, x=531..545 +x=287, y=681..684 +y=866, x=400..402 +x=387, y=1732..1739 +y=1026, x=460..465 +y=42, x=476..492 +y=1001, x=390..403 +x=482, y=1638..1654 +x=440, y=441..455 +y=853, x=341..359 +x=528, y=946..963 +y=1284, x=329..331 +x=405, y=453..458 +x=553, y=1458..1483 +x=508, y=229..239 +y=385, x=538..550 +x=323, y=280..293 +x=373, y=808..810 +x=297, y=997..1015 +y=1544, x=454..474 +x=545, y=1785..1788 +x=356, y=782..791 +x=292, y=1038..1061 +x=467, y=1035..1048 +x=312, y=489..503 +y=1546, x=325..348 +x=426, y=1107..1109 +y=1832, x=400..405 +x=479, y=1117..1143 +y=1049, x=398..404 +y=306, x=330..341 +x=388, y=669..671 +y=896, x=493..505 +x=361, y=1083..1092 +x=346, y=1662..1672 +x=466, y=1600..1609 +x=537, y=1511..1538 +x=545, y=67..76 +x=337, y=802..812 +x=461, y=1186..1211 +x=305, y=1377..1380 +x=349, y=87..95 +y=910, x=475..477 +y=715, x=369..564 +y=1814, x=393..395 +x=424, y=1847..1860 +x=443, y=1186..1190 +y=1838, x=529..555 +x=429, y=963..965 +y=978, x=373..377 +x=443, y=1649..1667 +y=400, x=377..379 +y=1268, x=345..347 +y=1241, x=467..481 +x=352, y=989..997 +x=439, y=571..580 +y=1031, x=330..333 +x=460, y=1000..1026 +x=545, y=100..118 +x=474, y=203..208 +y=1250, x=377..403 +x=504, y=1069..1083 +x=490, y=1613..1633 +x=351, y=681..690 +x=434, y=755..769 +y=1476, x=321..324 +x=423, y=957..969 +x=510, y=726..740 +x=368, y=1061..1072 +x=530, y=1150..1170 +x=557, y=501..518 +x=424, y=913..915 +x=394, y=763..776 +x=494, y=1642..1650 +y=1017, x=314..338 +x=356, y=1304..1314 +y=1083, x=504..507 +x=499, y=1271..1293 +x=496, y=1679..1696 +x=511, y=1791..1796 +y=171, x=410..423 +x=555, y=15..27 +x=321, y=316..332 +y=24, x=521..526 +x=519, y=729..734 +y=495, x=303..306 +y=752, x=462..477 +x=406, y=970..985 +y=965, x=429..431 +y=1336, x=444..453 +y=156, x=492..518 +y=670, x=339..342 +x=479, y=1431..1445 +x=316, y=1469..1481 +y=1586, x=394..398 +x=342, y=905..913 +x=477, y=1396..1399 +x=312, y=1619..1632 +x=404, y=821..833 +x=499, y=47..59 +x=343, y=590..594 +y=600, x=380..399 +x=468, y=766..767 +x=335, y=1427..1439 +x=443, y=1255..1263 +y=1301, x=429..456 +x=494, y=173..175 +y=1457, x=545..550 +x=319, y=1747..1757 +y=1826, x=507..509 +x=478, y=802..807 +x=429, y=568..577 +x=444, y=471..488 +y=1850, x=412..416 +x=507, y=1803..1826 +y=1544, x=421..435 +x=404, y=1042..1049 +y=162, x=314..325 +x=526, y=9..24 +x=348, y=1361..1371 +x=328, y=1723..1736 +x=374, y=1222..1224 +y=1280, x=289..309 +x=413, y=1119..1127 +x=333, y=1022..1031 +x=344, y=107..113 +y=1651, x=358..378 +y=1333, x=460..475 +y=910, x=429..456 +y=760, x=390..401 +x=373, y=535..562 +x=550, y=382..385 +y=745, x=396..424 +y=651, x=388..552 +x=483, y=1589..1596 +x=429, y=259..276 +x=478, y=1482..1484 +x=494, y=210..223 +x=381, y=215..228 +y=767, x=468..483 +x=389, y=321..323 +x=475, y=1476..1484 +x=473, y=397..418 +x=462, y=260..278 +y=1875, x=431..433 +x=318, y=1784..1789 +y=1206, x=469..471 +x=551, y=320..335 +x=436, y=1240..1244 +y=1403, x=295..314 +x=307, y=394..412 +x=548, y=297..304 +x=369, y=722..735 +x=350, y=553..579 +x=453, y=4..11 +y=178, x=480..505 +x=300, y=690..707 +x=351, y=1663..1672 +y=696, x=389..408 +x=378, y=1638..1651 +x=301, y=395..412 +x=418, y=1472..1498 +x=376, y=781..791 +x=492, y=330..336 +x=333, y=1044..1055 +x=500, y=720..746 +x=562, y=591..599 +y=59, x=499..504 +x=395, y=1310..1322 +y=136, x=513..529 +x=331, y=1281..1284 +y=940, x=520..540 +x=423, y=266..272 +x=430, y=622..634 +x=507, y=406..417 +x=504, y=1027..1048 +x=290, y=796..808 +y=1624, x=373..398 +x=340, y=337..355 +x=412, y=178..189 +x=530, y=1083..1104 +x=364, y=1179..1182 +y=941, x=544..555 +x=492, y=29..42 +y=1072, x=366..368 +x=477, y=910..923 +y=1170, x=319..341 +x=337, y=1177..1200 +y=107, x=486..502 +y=554, x=300..319 +y=422, x=383..404 +x=447, y=1481..1486 +x=425, y=788..812 +y=1580, x=500..509 +x=373, y=973..978 +x=300, y=1643..1657 +x=492, y=92..103 +x=354, y=1343..1355 +y=1399, x=477..504 +x=369, y=454..477 +x=354, y=1447..1461 +y=833, x=343..404 +x=516, y=1548..1550 +x=555, y=1811..1838 +x=398, y=1560..1586 +x=470, y=1392..1397 +x=355, y=1192..1203 +x=488, y=445..448 +x=327, y=860..871 +y=789, x=504..531 +y=405, x=464..466 +y=1244, x=413..436 +x=553, y=162..174 +x=369, y=1619..1630 +x=410, y=756..769 +x=347, y=1723..1736 +x=464, y=1640..1653 +x=482, y=1848..1862 +x=345, y=1265..1268 +y=1679, x=522..530 +x=401, y=68..72 +x=370, y=779..788 +x=519, y=130..133 +y=729, x=519..521 +x=391, y=63..79 +x=412, y=1850..1853 +x=377, y=1239..1250 +x=323, y=1354..1366 +y=776, x=374..394 +x=395, y=1812..1814 +x=433, y=275..289 +x=376, y=103..114 +x=344, y=987..999 +y=1535, x=404..418 +y=1188, x=507..509 +y=1441, x=390..395 +x=424, y=604..613 +x=356, y=641..655 +x=525, y=1113..1135 +y=1805, x=543..556 +x=287, y=1805..1817 +x=334, y=366..369 +x=465, y=1811..1831 +y=1428, x=292..317 +x=414, y=914..915 +x=337, y=1683..1696 +x=303, y=495..497 +y=28, x=542..546 +y=1830, x=534..542 +x=480, y=10..12 +x=411, y=1661..1668 +x=345, y=295..305 +x=362, y=1850..1862 +x=406, y=1686..1701 +x=508, y=1328..1332 +y=477, x=352..369 +y=1101, x=424..431 +x=354, y=529..539 +y=1227, x=339..389 +y=944, x=398..412 +x=548, y=124..141 +x=512, y=411..428 +x=396, y=685..693 +x=332, y=1303..1314 +x=339, y=646..670 +y=1168, x=396..398 +y=959, x=324..335 +x=477, y=730..752 +y=1439, x=330..335 +y=436, x=490..509 +x=484, y=1187..1211 +y=576, x=541..560 +x=315, y=216..235 +y=1078, x=463..487 +x=389, y=1215..1227 +x=523, y=1625..1648 +y=963, x=429..431 +x=466, y=444..454 +y=1208, x=417..431 +x=452, y=831..841 +y=1061, x=292..297 +x=474, y=1531..1544 +y=1281, x=504..512 +y=600, x=476..484 +x=421, y=1836..1839 +y=873, x=393..409 +y=1424, x=297..310 +x=504, y=1353..1355 +y=1653, x=458..464 +x=311, y=1119..1138 +x=374, y=763..776 +x=398, y=934..944 +y=880, x=466..475 +y=1667, x=422..443 +x=352, y=108..113 +x=509, y=301..310 +x=301, y=675..687 +x=337, y=1863..1871 +x=414, y=308..332 +x=347, y=1681..1691 +y=1045, x=452..460 +x=511, y=1313..1318 +y=1062, x=555..562 +x=404, y=210..237 +y=1092, x=361..365 +x=350, y=296..305 +x=355, y=1045..1055 +x=297, y=762..770 +x=331, y=984..995 +x=317, y=1185..1204 +x=502, y=94..107 +y=76, x=545..553 +x=374, y=27..37 +x=378, y=569..577 +y=30, x=364..366 +x=547, y=1760..1774 +y=1087, x=405..426 +y=649, x=361..364 diff --git a/problems/day17.html b/problems/day17.html new file mode 100644 index 0000000..2678d99 --- /dev/null +++ b/problems/day17.html @@ -0,0 +1,258 @@ + + + + +Day 17 - Advent of Code 2018 + + + + + + + +

Advent of Code

Neil Smith (AoC++) 34*

      /^2018$/

+ + + +
+

--- Day 17: Reservoir Research ---

You arrive in the year 18. If it weren't for the coat you got in 1018, you would be very cold: the North Pole base hasn't even been constructed.

+

Rather, it hasn't been constructed yet. The Elves are making a little progress, but there's not a lot of liquid water in this climate, so they're getting very dehydrated. Maybe there's more underground?

+

You scan a two-dimensional vertical slice of the ground nearby and discover that it is mostly sand with veins of clay. The scan only provides data with a granularity of square meters, but it should be good enough to determine how much water is trapped there. In the scan, x represents the distance to the right, and y represents the distance down. There is also a spring of water near the surface at x=500, y=0. The scan identifies which square meters are clay (your puzzle input).

+

For example, suppose your scan shows the following veins of clay:

+
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
+
+

Rendering clay as #, sand as ., and the water spring as +, and with x increasing to the right and y increasing downward, this becomes:

+
   44444455555555
+   99999900000000
+   45678901234567
+ 0 ......+.......
+ 1 ............#.
+ 2 .#..#.......#.
+ 3 .#..#..#......
+ 4 .#..#..#......
+ 5 .#.....#......
+ 6 .#.....#......
+ 7 .#######......
+ 8 ..............
+ 9 ..............
+10 ....#.....#...
+11 ....#.....#...
+12 ....#.....#...
+13 ....#######...
+
+

The spring of water will produce water forever. Water can move through sand, but is blocked by clay. Water always moves down when possible, and spreads to the left and right otherwise, filling space that has clay on both sides and falling out otherwise.

+

For example, if five squares of water are created, they will flow downward until they reach the clay and settle there. Water that has come to rest is shown here as ~, while sand through which water has passed (but which is now dry again) is shown as |:

+
......+.......
+......|.....#.
+.#..#.|.....#.
+.#..#.|#......
+.#..#.|#......
+.#....|#......
+.#~~~~~#......
+.#######......
+..............
+..............
+....#.....#...
+....#.....#...
+....#.....#...
+....#######...
+
+

Two squares of water can't occupy the same location. If another five squares of water are created, they will settle on the first five, filling the clay reservoir a little more:

+
......+.......
+......|.....#.
+.#..#.|.....#.
+.#..#.|#......
+.#..#.|#......
+.#~~~~~#......
+.#~~~~~#......
+.#######......
+..............
+..............
+....#.....#...
+....#.....#...
+....#.....#...
+....#######...
+
+

Water pressure does not apply in this scenario. If another four squares of water are created, they will stay on the right side of the barrier, and no water will reach the left side:

+
......+.......
+......|.....#.
+.#..#.|.....#.
+.#..#~~#......
+.#..#~~#......
+.#~~~~~#......
+.#~~~~~#......
+.#######......
+..............
+..............
+....#.....#...
+....#.....#...
+....#.....#...
+....#######...
+
+

At this point, the top reservoir overflows. While water can reach the tiles above the surface of the water, it cannot settle there, and so the next five squares of water settle like this:

+
......+.......
+......|.....#.
+.#..#||||...#.
+.#..#~~#|.....
+.#..#~~#|.....
+.#~~~~~#|.....
+.#~~~~~#|.....
+.#######|.....
+........|.....
+........|.....
+....#...|.#...
+....#...|.#...
+....#~~~~~#...
+....#######...
+
+

Note especially the leftmost |: the new squares of water can reach this tile, but cannot stop there. Instead, eventually, they all fall to the right and settle in the reservoir below.

+

After 10 more squares of water, the bottom reservoir is also full:

+
......+.......
+......|.....#.
+.#..#||||...#.
+.#..#~~#|.....
+.#..#~~#|.....
+.#~~~~~#|.....
+.#~~~~~#|.....
+.#######|.....
+........|.....
+........|.....
+....#~~~~~#...
+....#~~~~~#...
+....#~~~~~#...
+....#######...
+
+

Finally, while there is nowhere left for the water to settle, it can reach a few more tiles before overflowing beyond the bottom of the scanned data:

+
......+.......    (line not counted: above minimum y value)
+......|.....#.
+.#..#||||...#.
+.#..#~~#|.....
+.#..#~~#|.....
+.#~~~~~#|.....
+.#~~~~~#|.....
+.#######|.....
+........|.....
+...|||||||||..
+...|#~~~~~#|..
+...|#~~~~~#|..
+...|#~~~~~#|..
+...|#######|..
+...|.......|..    (line not counted: below maximum y value)
+...|.......|..    (line not counted: below maximum y value)
+...|.......|..    (line not counted: below maximum y value)
+
+

How many tiles can be reached by the water? To prevent counting forever, ignore tiles with a y coordinate smaller than the smallest y coordinate in your scan data or larger than the largest one. Any x coordinate is valid. In this example, the lowest y coordinate given is 1, and the highest is 13, causing the water spring (in row 0) and the water falling off the bottom of the render (in rows 14 through infinity) to be ignored.

+

So, in the example above, counting both water at rest (~) and other sand tiles the water can hypothetically reach (|), the total number of tiles the water can reach is 57.

+

How many tiles can the water reach within the range of y values in your scan?

+
+

Your puzzle answer was 34541.

--- Part Two ---

After a very long time, the water spring will run dry. How much water will be retained?

+

In the example above, water that won't eventually drain out is shown as ~, a total of 29 tiles.

+

How many water tiles are left after the water spring stops producing water and all remaining water not at rest has drained?

+
+

Your puzzle answer was 28000.

Both parts of this puzzle are complete! They provide two gold stars: **

+

At this point, you should return to your advent calendar and try another puzzle.

+

If you still want to see it, you can get your puzzle input.

+

You can also this puzzle.

+
+ + + + + + \ No newline at end of file diff --git a/src/advent17/advent17.hs b/src/advent17/advent17.hs new file mode 100644 index 0000000..97a2b59 --- /dev/null +++ b/src/advent17/advent17.hs @@ -0,0 +1,244 @@ +{-# LANGUAGE OverloadedStrings #-} + +import Debug.Trace + +import Data.Text (Text) +import qualified Data.Text as T +import qualified Data.Text.IO as TIO + +import Data.Void (Void) + +import Text.Megaparsec +import Text.Megaparsec.Char +import qualified Text.Megaparsec.Char.Lexer as L +import qualified Control.Applicative as CA + +import Data.List +-- import qualified Data.Set as S + +import qualified Data.Map.Strict as M +import Data.Map.Strict ((!)) +import Data.Tuple (swap) + +type SoilSpecLine = ((Text, Integer), (Text, Integer, Integer)) +type Coord = (Integer, Integer) -- x, y +data Soil = Sand | Clay | Still | Flowing deriving (Eq, Show, Enum, Bounded, Ord) +type Ground = M.Map Coord Soil + +main :: IO () +main = do + text <- TIO.readFile "data/advent17.txt" + let soilSpec = successfulParse text + -- print soilSpec + let ground = makeGround soilSpec + -- print ground + -- putStrLn $ showGround ground + -- putStrLn $ showGround $ handleSource ground (500, 0) + -- print $ handleSource ground (500, 0) + let ground' = filled ground + print $ part1 ground' + print $ part2 ground' + -- print $ part1 tests + -- print $ part2 tests program + + +part1 ground = M.size $ M.union still flowing + where (_minX, _maxX, minY, maxY) = bounds ground + inBoundGround = M.filterWithKey (\(_x, y) _ -> (y >= minY) && (y <= maxY)) ground + still = M.filter (== Still) inBoundGround + flowing = M.filter (== Flowing) inBoundGround + +part2 ground = M.size $ still + where (_minX, _maxX, minY, maxY) = bounds ground + inBoundGround = M.filterWithKey (\(_x, y) _ -> (y >= minY) && (y <= maxY)) ground + still = M.filter (== Still) inBoundGround + +makeGround :: [SoilSpecLine] -> Ground +makeGround soilSpec = foldl' addSpecLine M.empty soilSpec + +addSpecLine :: Ground -> SoilSpecLine -> Ground +addSpecLine ground ((fixed, fixedVal), (ranged, from, to)) = + foldr (\c -> M.insert c Clay) ground addedCells + where cells = [(fixedVal, i) | i <- [from..to] ] + addedCells = if fixed == "x" then cells else map swap cells + +showGround :: Ground -> String +showGround ground = unlines $ map (showGroundLine minX maxX ground) [minY..maxY] + where (minX, maxX, minY, maxY) = bounds ground + +showGroundLine :: Integer -> Integer -> Ground -> Integer -> String +showGroundLine minX maxX ground y = [showGroundCell x | x <- [minX..maxX]] + where showGroundCell x = if (x, y) `M.member` ground + then case ground!(x, y) of + Clay -> '#' -- '\x2591' + Flowing -> '|' + Still -> 'o' -- '\x2593' + Sand -> '.' + else '.' + +bounds :: Ground -> (Integer, Integer, Integer, Integer) +bounds ground = (minX, maxX, minY, maxY) + where keys = M.keys ground -- $ M.filter (== Clay) ground + minX = minimum $ map fst keys + maxX = maximum $ map fst keys + minY = minimum $ map snd keys + maxY = maximum $ map snd keys + +up (x, y) = (x, y-1) +down (x, y) = (x, y+1) +left (x, y) = (x-1, y) +right (x, y) = (x+1, y) + + +filled :: Ground -> Ground +filled ground = handleSource ground (500, 0) + + +handleSource :: Ground -> Coord -> Ground +-- handleSource ground here | trace ("source " ++ show here ++ "\n" ++ showGround ground) False = undefined +handleSource ground here + | (snd here) > maxY = ground + | otherwise = flood ground' here + where (_minX, _maxX, _minY, maxY) = bounds ground + under = M.findWithDefault Sand (down here) ground + ground' = if under == Sand + then handleSource (M.insert here Flowing ground) (down here) + else M.insert here Flowing ground + + -- else if (down here) `M.notMember` ground + -- then handleSource ground' (down here) + -- else flood ground' here + -- where (_minX, _maxX, _minY, maxY) = bounds ground + -- ground' = (M.insert here Water ground) + +flood :: Ground -> Coord -> Ground +-- flood ground here | trace ("flood " ++ show here) False = undefined +flood ground here = foldl' handleSource groundB sources + where (groundL, sourcesL, boundL) = floodLeft ground here + (groundR, sourcesR, boundR) = floodRight groundL here + sources = sourcesL ++ sourcesR + groundB = if boundL && boundR + then stillWater groundR here + else groundR + + + -- if null sources + -- then flood groundLR (up here) + -- else foldl' handleSource groundLR sources + -- where (groundL, sourcesL) = floodLeft ground here + -- (groundLR, sourcesR) = floodRight groundL here + -- sources = sourcesL ++ sourcesR + +-- if the ground under is sand, create a new source +-- otherwise, +-- if the groudnd to the left is clay, stop +-- if the ground to the left isn't clay, flood left + +floodLeft :: Ground -> Coord -> (Ground, [Coord], Bool) +-- floodLeft ground here | trace ("flood <= " ++ show here) False = undefined +floodLeft ground here = + if leftWards == Clay + then (ground, [], True) + else case (under, underLeft) of + (Clay, Sand) -> (ground', [left here], False) + (Clay, Clay) -> floodLeft ground' (left here) + (Still, Still) -> floodLeft ground' (left here) + (Still, Clay) -> floodLeft ground' (left here) + (Clay, Still) -> floodLeft ground' (left here) + _ -> (ground, [], False) + where ground' = (M.insert (left here) Flowing ground) + under = M.findWithDefault Sand (down here) ground + leftWards = M.findWithDefault Sand (left here) ground + underLeft = M.findWithDefault Sand (left (down here)) ground + + +floodRight :: Ground -> Coord -> (Ground, [Coord], Bool) +-- floodRight ground here | trace ("flood => " ++ show here) False = undefined +floodRight ground here = + if rightWards == Clay + then (ground, [], True) + else case (under, underRight) of + (Clay, Sand) -> (ground', [right here], False) + (Clay, Clay) -> floodRight ground' (right here) + (Still, Still) -> floodRight ground' (right here) + (Still, Clay) -> floodRight ground' (right here) + (Clay, Still) -> floodRight ground' (right here) + _ -> (ground, [], False) + where ground' = (M.insert (right here) Flowing ground) + under = M.findWithDefault Sand (down here) ground + rightWards = M.findWithDefault Sand (right here) ground + underRight = M.findWithDefault Sand (right (down here)) ground + -- if under == Sand + -- then (ground', [here]) + -- else if rightWards == Clay + -- then (ground', []) + -- else if (under == Water) && (rightWards == Sand) + -- then (ground', []) + -- else floodRight ground' (left here) + -- where ground' = (M.insert here Water ground) + -- under = M.findWithDefault Sand (down here) ground + -- rightWards = M.findWithDefault Sand (right here) ground +-- floodRight ground here = + -- case under of + -- Sand -> (ground', [here]) + -- Water -> (ground', []) + -- otherwise -> if (right here) `M.notMember` ground + -- then floodRight ground' (right here) + -- else if ground!(right here) == Water + -- then floodRight ground' (right here) + -- else (ground', []) + -- where ground' = (M.insert here Water ground) + -- under = M.findWithDefault Sand (down here) ground + +stillWater :: Ground -> Coord -> Ground +-- stillWater ground here | trace ("stilling " ++ show here) False = undefined +stillWater ground here = stillWaterR groundL here + where groundL = stillWaterL ground here + +stillWaterL :: Ground -> Coord -> Ground +-- stillWaterL ground here | trace ("stilling L" ++ show here) False = undefined +stillWaterL ground here = + if ground!(left here) == Clay + then ground' + else stillWaterL ground' (left here) + where ground' =(M.insert here Still ground) + +stillWaterR :: Ground -> Coord -> Ground +-- stillWaterR ground here | trace ("stilling R" ++ show here) False = undefined +stillWaterR ground here = + if ground!(right here) == Clay + then ground' + else stillWaterR ground' (right here) + where ground' = (M.insert here Still ground) + + + +-- Parse the input file + +type Parser = Parsec Void Text + +sc :: Parser () +sc = L.space (skipSome spaceChar) CA.empty CA.empty + +lexeme = L.lexeme sc +integer = lexeme L.decimal +symb = L.symbol sc + +equalP = symb "=" +commaP = symb "," +ellipsisP = ".." +axisP = symb "x" <|> symb "y" + +fileP = many rowP + +rowP = (,) <$> fixedP <* commaP <*> rangeP + +fixedP = (,) <$> axisP <* equalP <*> integer +rangeP = (,,) <$> axisP <* equalP <*> integer <* ellipsisP <*> integer + + +successfulParse :: Text -> [SoilSpecLine] +successfulParse input = + case parse fileP "input" input of + Left _error -> [] -- TIO.putStr $ T.pack $ parseErrorPretty err + Right soilSpec -> soilSpec \ No newline at end of file -- 2.34.1