diff options
author | Marvin Borner | 2024-03-21 13:23:41 +0100 |
---|---|---|
committer | Marvin Borner | 2024-03-21 13:34:34 +0100 |
commit | 2065029025c6e53eb550717755996d1d6fc5f60d (patch) | |
tree | b2ed64b9cb890925a57edc0577ef6faab7519b61 /samples/aoc | |
parent | 93b53a5354620d94b128008d0b17670cc87c92f5 (diff) |
Fixed AOC samples
Diffstat (limited to 'samples/aoc')
-rw-r--r-- | samples/aoc/2021/01/input | 210 | ||||
-rw-r--r-- | samples/aoc/2021/01/solve.bruijn | 6 | ||||
-rw-r--r-- | samples/aoc/2022/01/solve.bruijn | 10 | ||||
-rw-r--r-- | samples/aoc/2023/01/input | 2 | ||||
-rw-r--r-- | samples/aoc/2023/01/solve.bruijn | 7 |
5 files changed, 22 insertions, 213 deletions
diff --git a/samples/aoc/2021/01/input b/samples/aoc/2021/01/input index f522f3f..59dad67 100644 --- a/samples/aoc/2021/01/input +++ b/samples/aoc/2021/01/input @@ -1,200 +1,10 @@ -1227 -1065 -329 -1063 -1889 -1700 -1805 -1373 -389 -1263 -1276 -1136 -1652 -1981 -1406 -1249 -1197 -1379 -1050 -1791 -1703 -2001 -1842 -1707 -1486 -1204 -1821 -1807 -1712 -1871 -1599 -1390 -1219 -1612 -1980 -1857 -1511 -1702 -1455 -1303 -1052 -1754 -1545 -1488 -1848 -1236 -1549 -1887 -1970 -1123 -1686 -1404 -1688 -1106 -1296 -401 -1829 -1693 -1389 -1957 -914 -1176 -1348 -1275 -1624 -1401 -1045 -1396 -1352 -1569 -1060 -1235 -1679 -1503 -1340 -1872 -1410 -1077 -958 -1681 -1189 -1466 -1087 -1852 -1293 -1139 -1300 -1323 -661 -1388 -1983 -1325 -1112 -1774 -1858 -1785 -1616 -1255 -1198 -1354 -1124 -1834 -1417 -1918 -1496 -33 -1150 -1861 -1172 -2006 -1199 -1558 -1919 -1620 -1613 -1710 -1477 -1592 -1709 -1909 -1670 -1922 -1840 -1768 -1982 -1193 -1736 -1877 -1770 -1191 -1433 -1072 -1148 -1225 -1147 -1171 -1424 -1913 -1228 -1339 -1814 -1504 -1251 -1240 -1272 -1500 -1927 -1428 -1641 -1453 -1729 -1976 -1808 -1180 -1024 -1108 -1085 -1669 -1636 -1005 -1520 -1929 -1626 -1551 -1234 -1988 -1256 -1524 -1571 -1506 -1977 -1749 -1408 -1540 -1934 -1810 -1328 -1910 -1478 -1600 -1699 -1413 -1446 -1798 -1013 -1998 -1661 -1058 -1051 -1220 -1447 -1675 -1912 -1668 -1932 -1962 -1055 -1757 -1116 -1090 +199 +200 +208 +210 +200 +207 +240 +269 +260 +263
\ No newline at end of file diff --git a/samples/aoc/2021/01/solve.bruijn b/samples/aoc/2021/01/solve.bruijn index 1c14b3b..b73c0db 100644 --- a/samples/aoc/2021/01/solve.bruijn +++ b/samples/aoc/2021/01/solve.bruijn @@ -1,9 +1,9 @@ -:import std/Math . :import std/String . +:import std/Math . -part1 [{ [[(1 <? 0) (+1) (+0)]] | 0 , ~0 }] +part1 [{ [[(1 <? 0) (+1) (+0)]] | 0 ; ~0 }] -part2 [{ [[(1 <? 0) (+1) (+0)]] | 0 , ~(~(~0)) }] +part2 [{ [[(1 <? 0) (+1) (+0)]] | 0 ; ~(~(~0)) }] main [parts nums] nums string→number <$> (lines 0) diff --git a/samples/aoc/2022/01/solve.bruijn b/samples/aoc/2022/01/solve.bruijn index 7b2eaf6..e213e85 100644 --- a/samples/aoc/2022/01/solve.bruijn +++ b/samples/aoc/2022/01/solve.bruijn @@ -1,9 +1,7 @@ +:import std/Combinator . :import std/Math . :import std/String . -main [answer] - numbers string→number <$> (lines 0) - parts split-list-by =?‣ numbers - sums sum <$> parts - answer build (sort-desc sums) - build [^0 : ∑(take (+3) 0)] +main blocks → (map (map string→number)) → (map sum) → sort-desc → res + res [^0 : (^0 + ^(~0) + ^(~(~0)))] + blocks [split-list-by (eq? "\n") (lines 0)] diff --git a/samples/aoc/2023/01/input b/samples/aoc/2023/01/input index 7bbc69a..1ba8437 100644 --- a/samples/aoc/2023/01/input +++ b/samples/aoc/2023/01/input @@ -1,4 +1,4 @@ 1abc2 pqr3stu8vwx a1b2c3d4e5f -treb7uchet +treb7uchet
\ No newline at end of file diff --git a/samples/aoc/2023/01/solve.bruijn b/samples/aoc/2023/01/solve.bruijn index 74361a2..2ed5c5f 100644 --- a/samples/aoc/2023/01/solve.bruijn +++ b/samples/aoc/2023/01/solve.bruijn @@ -1,7 +1,8 @@ -:import std/Math . +:import std/Combinator . :import std/String . -:import std/Char C +:import std/Math . +:import std/Char . -part1 [[^0 ⋅ (+10) + _0] (filter (gre? (+9)) (C.char→number <$> 0))] +part1 (filter numeric?) → [^0 : {}(_0)] → string→number main [∑(part1 <$> (lines 0))] |