aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-12-20 22:51:11 +0100
committerMarvin Borner2020-12-20 22:51:41 +0100
commite5503da5f641857184953e7684c25ea98b54fe03 (patch)
tree7a7d3df6098790173c2272a9f3e672cf4143b539
parent144f82f96782c6f0dbd85df836afaca284bec022 (diff)
Added README
-rw-r--r--2020/20/input1792
-rw-r--r--2020/20/solve.c81
-rw-r--r--README.md7
3 files changed, 156 insertions, 1724 deletions
diff --git a/2020/20/input b/2020/20/input
index d2ee427..b07aa4b 100644
--- a/2020/20/input
+++ b/2020/20/input
@@ -1,1727 +1,107 @@
-Tile 3733:
-#.#.#..#.#
-...#..#.##
-.#...#...#
-#.###.....
-..##.....#
-##......#.
-#......#.#
-...#....#.
-###.##...#
-######..##
-
-Tile 3253:
-##..#...##
-#.....#.#.
-....#...##
-#........#
-.......#.#
-##.####...
-..#......#
-...#......
-#.#.....##
-###...###.
-
-Tile 2939:
-####...###
-.#....#..#
-....##....
-..##......
-.#....#...
-#.....#...
-#.....#...
-##........
-......#...
-##.#.#..#.
-
-Tile 3583:
-....#####.
-..#...##.#
-....#.##..
-#.#..#.#..
-..#......#
-......#...
-#...##...#
-#..#...#..
-...#...##.
-..##.###.#
-
-Tile 3761:
-#.##.....#
-##.......#
-..#...#..#
-#.#..#.#..
-#......#.#
-...#...#..
-..##.....#
-#.#..##...
-##.......#
-#...#..##.
-
-Tile 1487:
-...#....##
-#..#....##
-#.......#.
-.#.#..###.
-.......#..
-#....#..##
-...#..#..#
-#......#..
-.###....##
-##.#...##.
-
-Tile 1279:
-..#..##.##
-.........#
-....#.##.#
-....#..#..
-##...#..##
-#......##.
-#.#....###
-.#.....###
-....##.#..
-#.#######.
-
-Tile 1231:
-#.........
-..#...#...
-#...#....#
-#..#.##..#
-..#....#.#
-.##.....#.
-#.#....#.#
-#..#..#...
-#.........
-#...##.#.#
-
-Tile 2837:
-#.###.#...
-#.........
-###.#...#.
-#.#.#.#..#
-.##.......
-#.......##
-......#..#
-###..#....
-#...#.....
-.#..###...
-
-Tile 1447:
-......##.#
-.#..#.....
-#..##.....
-#.........
-.......###
-..........
-..........
-#..##....#
-....#.....
-#.##.####.
-
-Tile 1297:
-...#....##
-#.......#.
-#....##.##
-#..#...#.#
-##...#.#..
-#..#...###
-........#.
-#.....#..#
-.........#
-#.##.#....
-
-Tile 3449:
-........#.
-##..##..##
-.#...#.#..
-#...#....#
-#.....##..
-#.......##
-#.#.#...##
+Tile 2311:
+..##.#..#.
+##..#.....
#...##..#.
-##.#####.#
-...#..#..#
-
-Tile 1621:
-#...####.#
-#...#.##..
-#........#
-.......#.#
-#..#...#.#
-#....#....
-....#..#.#
-...##...##
-.........#
-.#....##.#
-
-Tile 3187:
-##..##.#..
-##.#..#...
-...#..#.##
-....#....#
-#........#
-....#..##.
-#........#
-#.#...##..
-#..#.#..#.
-#.#..###.#
-
-Tile 1181:
-#..##.#.#.
-....#....#
-#...#....#
-#..#..#..#
-###...###.
-........##
-....#.....
-#..#.....#
-##...#...#
-#.#..#.#..
-
-Tile 3541:
-#.###..#..
-#..###..##
-#...#...#.
-#..###....
-......#..#
-#.........
-#.#...#..#
-##.......#
-..........
-..#...##..
-
-Tile 2591:
-#...#.###.
-.###..##..
-#.......##
-.........#
-#.........
-#####....#
-#..#....#.
-#........#
-...#.#..##
-.##.......
-
-Tile 2789:
-#...#..#..
-##....#.##
-...#......
-..#.#.....
-.........#
-##...#.#..
-.....#.#.#
-#...#....#
-##....#..#
-##..#..#..
-
-Tile 2503:
-#.#.#####.
-.....#.##.
-#.........
-#.........
-..#..#..##
-##....####
-.#.....#..
-..........
-###.......
-..#..#..##
-
-Tile 3617:
-##..####.#
-#..#.##.#.
-....##.##.
-#..###...#
-#.#.#....#
-.#.#....##
-.....##..#
-.......#..
-#...#.#..#
-.##.#..#.#
-
-Tile 1051:
-######...#
-#.#..#..##
-##....##.#
-.......#.#
-...#.....#
-##.......#
-...#......
-.#.###...#
-.......#.#
-.##.###...
-
-Tile 1049:
-.#..##..##
-#...#.....
-...#.#...#
-#.........
-#.........
-..###.....
-#.......#.
-..........
-#......##.
-...###.###
-
-Tile 1973:
-#.###.##..
-....#.####
-....#....#
-##....#...
-..##....##
-#..#......
-##......#.
-#.....#...
-..........
-########.#
-
-Tile 3169:
-.#####.#..
-#........#
-#..#..#..#
-...#....#.
-.#........
-#.#.##..#.
-.#........
-..........
-#....#....
-#......##.
-
-Tile 1217:
-###.#.....
-#.....#...
-..#.##....
-.....#...#
-#.....#..#
-##.#...###
-#.#......#
-...##.#..#
-#....#.#.#
-#.#....###
-
-Tile 1327:
-#####..###
-..##.#.##.
-..#......#
-#......#..
-#..##.#...
-.......###
-#...##...#
+####.#...#
+##.##.###.
+##...#.###
+.#.#.#..##
..#....#..
-.#.......#
-#.....####
+###...#.#.
+..###..###
-Tile 1693:
-.##.###.##
-#...#.....
-...#..#.#.
-..#.......
-#.........
-..#......#
-#.##......
-...#.#...#
-#..#.#...#
-.#.###.##.
-
-Tile 1367:
-.#...#..#.
-...#.#...#
-#........#
-#........#
-..#..##...
-.##.......
-........#.
-#.........
-...#....#.
-#.#..#...#
-
-Tile 1559:
-#.##.#.###
-#.###..#..
-..#..#.##.
-#..#....##
-..#.#..#..
-##.#....##
-#...#.....
-#...#..#.#
-..#.#.##.#
-.###....##
-
-Tile 3727:
-.#..####..
-....##....
-#....#...#
-#.###.#...
-.........#
-#####..#.#
-.####.#.#.
-..#.....##
-#..#..#...
+Tile 1951:
+#.##...##.
+#.####...#
+.....#..##
+#...######
+.##.#....#
.###.#####
+###.##.##.
+.###....#.
+..#.#..#.#
+#...##.#..
-Tile 3491:
-.###...###
-##.#..##.#
-...#...#.#
-.##.....#.
-.....#.###
-.....#...#
-#.#.....##
-.......#.#
-##.....#..
-###.##..##
-
-Tile 3547:
-#......###
-...#....##
-.#..#...##
-...##.##.#
-#....#...#
-#.#.......
-#..#.#..#.
-###.##....
-......#...
-..#.##.#.#
-
-Tile 2963:
-#####..#.#
-..#...#...
-...##..#..
-...#....##
-###......#
-#.......##
-#.....##..
-#..#...#.#
-.......#.#
-#..#.#...#
-
-Tile 2099:
-###.#####.
-....#.....
-........#.
-..#..#...#
-...#.#.#.#
-#.........
-##...#...#
-.#...###.#
-#...#.#..#
-.........#
-
-Tile 2879:
-#..#.#.##.
-##...#..##
-.....#...#
-#.#.#..#.#
-.#.#..#...
-........#.
-.#..#.#.#.
-#..#.....#
-#.........
-#.#.#.##.#
-
-Tile 1277:
-#..#..##.#
-#..#...###
-.....#..#.
-.....#....
-...#.##..#
-....#....#
-....##...#
-##.##.....
-#......#..
-.#.#...###
-
-Tile 3863:
-#..#..##.#
-#.#.#...##
-...###..##
-.#.#.....#
-..........
-.##.......
-##.#......
-....#....#
-##.#.###.#
-...#..####
-
-Tile 3623:
-....#.###.
-#..##.....
-.....#.#..
-...#...###
-##........
-#.........
-#....#...#
-.#...#...#
-.........#
-..#.#.#.##
-
-Tile 3581:
-#....#...#
-##.###..##
-#...#..#..
-..#.##....
-.#..#....#
-.#.....##.
-#.#...##.#
-#....#.#.#
-...#.....#
-..#......#
-
-Tile 1901:
-..#.#..###
-#.#...#.##
-.#........
-###.#...#.
-.....#....
-.#...#..##
-#...#....#
-##........
-...#...###
-##.#.####.
-
-Tile 1667:
-..#.#.##.#
-#.#.......
-...#.....#
-#..#.....#
-........##
-#.#.#.....
-........#.
-#....#.#..
-.......##.
-#...#.#.#.
-
-Tile 1709:
-#..####.#.
-.##..#...#
-....#....#
-......#..#
-...#.#....
-#......#..
-#.#..#..##
-...###..##
-##......#.
-#.#.##..##
-
-Tile 1307:
-#..#...#.#
-#.#.....##
-#.#......#
-........##
-.....#....
-#........#
-...##...##
-#........#
-#...#.#...
-#..###....
-
-Tile 1997:
-##.......#
-#.#......#
-.......#..
-.....###..
-.##.....#.
-.#..##...#
-.#.#....##
-#....###.#
-#..###..#.
-..###..##.
-
-Tile 3389:
-#.#.#.###.
-.........#
-#.#.#....#
-#.........
-#.#.......
-..#...#..#
-#..#......
-#.........
-#.#....###
-.###.#.###
-
-Tile 2729:
-##.#...#.#
-.....#....
-......#.#.
-#.......#.
-...#...#.#
-..#.......
-#........#
-#........#
-....#.#...
-.#####....
-
-Tile 2467:
-..#.#..###
-.##.#.#...
-#....#...#
-...#.##.##
-...###....
-#..#.....#
-##........
-#...#....#
-##...#..##
-#####.#.#.
-
-Tile 2179:
-###.#...#.
-#......#..
-..#......#
-.......##.
-..##.#.#.#
-....#....#
-.........#
-#..#.....#
-.#..#....#
-###.#..##.
-
-Tile 1879:
-##.####..#
-.......##.
-.........#
-.#.#.....#
-##..##.#..
-#........#
-.#.#..#.##
-#.#.##..#.
-##.#.#....
-.#...#.##.
-
-Tile 1087:
-..###.#.##
-....#.....
-#......###
-........##
-.#......#.
-#.#....#.#
-..........
-###......#
-#.#...##..
-.##.##.#.#
-
-Tile 3331:
-#.###....#
-.....##..#
-....#.#...
-#.#.......
-#........#
-....#.##.#
-#...###..#
-....##....
-#.#.#.#...
-....###.##
-
-Tile 1789:
-##.#.#.###
-##..#..#.#
-..##....#.
-.#....##..
-.....#....
-#........#
-#.......#.
-#........#
-#.....##.#
-.###.#....
-
-Tile 1949:
-####..##..
-#....#....
-#.#..#....
-#.#...#...
-..#...#.#.
-.#.#......
-.#....#.##
-#..###...#
-#.#..#....
-..##.##..#
-
-Tile 2311:
-#...##..##
-..#.#.....
-#.........
-#.#.#....#
-.#..#....#
-..........
-....#.....
-..#.#...##
-#..##....#
-###.######
-
-Tile 1091:
-###.#.####
-#..#.###.#
-..........
-#........#
-##.....#..
-.........#
-.....#.#.#
-###..##...
-.......##.
-..#...##..
-
-Tile 3593:
-##...##..#
-.##.#.##.#
-#.#..#..##
-...#......
-.##.#.....
-#.#..#.###
-#.......#.
-........##
-.........#
-#..#.#....
-
-Tile 2137:
-#.#..#...#
-.....#....
-....#....#
-..#.....#.
-#....#..##
-.#....#.##
-........##
-.#.#....##
-..........
-.#.#..#..#
-
-Tile 2251:
-##..##.###
-##.#......
-.#.....###
-.....#.#.#
-##....####
-#.#..##.##
-###.....#.
-.#....#...
-#.........
-#..#...#..
-
-Tile 1021:
-#..####.#.
-##.....#.#
-#.##...#..
-#....#..##
-#........#
-..#.......
-#.....#...
-#........#
-..........
-..####...#
-
-Tile 2543:
-.#..#.###.
-#...#.#..#
-.#...#....
-##..##...#
-#.##.#...#
-.....#....
-..##...###
-#.......#.
-#.#....#..
-..#.#..##.
-
-Tile 2339:
-#.#####.##
-#...#..#.#
-#...#.#...
-#........#
-#.#.......
-....#.#..#
-###...#.##
-#.........
-......#...
-..####..#.
-
-Tile 1697:
-##...#####
-.......##.
-#.#..#.###
-#.#.......
-.#.#....##
-#..####..#
-##....#..#
+Tile 1171:
####...##.
-...#..#...
-.###.....#
-
-Tile 3271:
-##.#.#.##.
-.........#
-...#.#....
-..#......#
-##...#....
-#.#.#..###
-......###.
-#.##...#..
-.#.#.#..##
-.#...###..
-
-Tile 1801:
-##.#.#....
-#......#.#
-#.#...#...
-...###..##
-##....#..#
-.........#
-..##.#..##
-#..#....##
-#.........
-#...#.####
-
-Tile 2389:
-#..#....#.
-#....###.#
-#....#.#..
-......#.##
-.#.#...#..
-.......#.#
-.........#
-#......##.
-.......#.#
-..#..#....
-
-Tile 3793:
-###.##..#.
-#...#...##
-#........#
-#..#......
-....###..#
-#.#.#.#..#
-#.....##..
-##.#......
-....##.#..
-##.#.###.#
-
-Tile 2213:
-.##.#..#..
-.....#....
-..##..####
-#.......#.
-#..#.....#
-#........#
-#...#.#.##
-...#.....#
-.#........
-#....####.
-
-Tile 2593:
-..#.#.....
-##...#...#
-.......#.#
-#......###
-#.....#...
-##....#..#
-#........#
-#....##..#
-....#.....
-#####.#...
-
-Tile 1907:
-##.###....
-#####.....
-......#...
#..##.#..#
-....#...#.
-....#.....
-.#.#......
-....#....#
-......#..#
-##..####.#
-
-Tile 3719:
-#..##.#..#
-#..#.....#
+##.#..#.#.
+.###.####.
+..###.####
+.##....##.
+.#...####.
+#.##.####.
+####..#...
.....##...
-......#.#.
-##..#....#
-#.........
-#.....#...
-......#...
-#...##...#
-.#..##.#.#
-
-Tile 3659:
-#.#.....##
-##.#....#.
-#....#...#
-#......###
-.....###..
-.##.#.#..#
-.#.#.#...#
-.#...#....
-...#.#.#.#
-##.#.#..##
-
-Tile 1303:
-#.##.#..#.
-#.#..#.#.#
-#...#..#..
-#.#....###
-........##
-..#.#..#..
-.....#...#
-#.#..#....
-...####...
-...##..#..
-
-Tile 1607:
-######....
-..##......
-####.#..#.
-.####.##.#
-.........#
-.#.......#
-.#.#..#..#
-###.##...#
-..#..#...#
-.##...#.##
-
-Tile 1109:
-...#.#...#
-........##
-#.....#..#
-##..##..#.
-#.#......#
-#.....#..#
-#...#....#
-.#.......#
-.#.#...#.#
-#...#####.
-
-Tile 3797:
-##...#.#.#
-#..#####.#
-#####...##
-..##......
-..........
-......#.##
-..#..#..#.
-#####.##..
-##......#.
-..##.#.#..
-
-Tile 3923:
-...###..##
-#..##.....
-#.#......#
-.##.##....
-#..#..#..#
-####....#.
-#........#
-...#......
-..##...#.#
-####......
-
-Tile 2609:
-##..###...
-#.........
-###..#...#
-#.##..#.#.
-#...#..#..
-#.#....##.
-#.#...##.#
-###....#.#
-..#....#.#
-....#.##.#
-
-Tile 3391:
-....######
-#...#..#..
-...#.#...#
-#...#..#..
-#..##....#
-.#..#....#
-#.#......#
-.......#.#
-.....#....
-###.#...#.
-
-Tile 1423:
-###....#.#
-..#.......
-##...##...
-..........
-#.#.###.##
-..#....###
-.#......##
-#.#..#.#..
-#....##.#.
-....##...#
-
-Tile 2399:
-..#...#..#
-..#.#...#.
-##.....##.
-#......#..
-....#....#
-#........#
-#......#.#
-...#......
-.......#..
-##...#.###
-
-Tile 1741:
-...#..##..
-...#.....#
-#.#..#...#
-..##...#..
-#........#
-#....#.#.#
-#..##....#
-.#........
-.###...#.#
-....###.#.
-
-Tile 2887:
-#.#.#.#.##
-.#......#.
-#.#..#...#
-#........#
-......#.##
-..#.#....#
-#....#....
-#....#.#..
-###...#...
-####...##.
-
-Tile 2351:
-..####.#..
-....#....#
-#.#.#...##
-.........#
-#.#...##..
-#..#.#..#.
-#.........
-##......#.
-#........#
-#...#....#
-
-Tile 1061:
-.#..###.##
-......##..
-###......#
-#.#...#...
-.....#.###
-#.........
-#....#....
-..........
-#.##.....#
-#####.#..#
-
-Tile 1009:
-..#..##.#.
-.....#...#
-#......#.#
-..#.......
-.#..##...#
-#...#.#..#
-..#.......
-#.....#..#
-....#.###.
-..##..#.##
-
-Tile 3821:
-.##..##.#.
-...#...#.#
-#.##..#..#
-...#.#...#
-.....#...#
-.....##.#.
-....#....#
-#.....##.#
-#..#......
-.....#...#
-
-Tile 3011:
-.#.##.#..#
-.....#....
-......##.#
-..##.##..#
-....##....
-#..#.#...#
-..#......#
-##....#...
-##.......#
-#.####.###
-
-Tile 2833:
-.#.##....#
-.......#..
-#.##.##..#
-..#.#....#
-#.#....#..
-##.#......
-..........
-.#...#...#
-##.#.....#
-######.#..
-
-Tile 1409:
-..#......#
-..#.#..###
-#.#..#...#
-#...#..#.#
-#.....#..#
-.##..#..##
-..#......#
-......#...
-#......#.#
-##..#.#..#
-
-Tile 3527:
-........##
-.........#
-........#.
-...#..##.#
-......##..
-###.#..#.#
-...#....#.
-#.......##
-..........
-.#....###.
-Tile 3461:
-#.#.#.###.
-#.#......#
-##.......#
-#..#.##...
-..##......
-...#....##
-#....#....
-..#.....##
-#...#...##
-#.#..##.##
-
-Tile 2663:
-..###.##.#
-#.##.....#
-.##.#...#.
-.#.....#.#
-#.#..###.#
-....##.#.#
-.........#
-#.##.#.#.#
-.........#
-#.###..#.#
-
-Tile 1511:
-.####.#.##
-.....#.###
-#...#....#
-...##....#
-..#.#.....
-..#...#..#
-..........
-#...##...#
-.#....#...
-#...#.###.
-
-Tile 2801:
-####.##..#
-....##...#
-#........#
-##..#..#..
-.....#...#
-....#.....
-......#..#
-#......##.
-.........#
-#..#####..
-
-Tile 2381:
-....####..
-..#.......
-...#..#..#
-#..#......
-#..#....#.
-#.........
-#.........
-#...#.#..#
-..####...#
-#....#.#.#
-
-Tile 1583:
-#...##.###
-#.#...##.#
-#.......#.
-...##....#
-#...#..#..
-##.......#
-......#..#
-#..#...#.#
-.##.#....#
-##....#.##
-
-Tile 1123:
-#...#...#.
-#..#..#...
-.#.......#
-#....#.###
-#.#...##..
-.#.....#.#
-.##.#..#..
-..........
-.##.#..#.#
-#.#####.##
-
-Tile 2797:
-#..#..#...
-....#.#.##
-......#.##
-#......##.
-#.......##
-...#.....#
-..##.....#
-.#.#.#...#
-##....#...
-..#.#.##.#
-
-Tile 3889:
-#.#.####.#
+Tile 1427:
+###.##.#..
.#..#.##..
-.....##..#
-##........
-#..#.....#
-#........#
-..#.....#.
-#.#.#....#
-.....##..#
-##.##.#..#
-
-Tile 2557:
-###.#....#
-##...#....
-...##.#...
-...#.....#
-..........
-#........#
-.#...#....
-.....#....
-..........
-#...##.#..
-
-Tile 1747:
-#..##...##
-.....#.#..
-.#.##.####
-##.......#
-###...#..#
-###.....#.
-#..#.....#
-#.#.......
-....###...
-###.#.##..
-
-Tile 3023:
-##..##...#
-#....#...#
-#.#......#
-...#...#.#
-..#.#.#..#
-#.......#.
-.......#.#
-..........
-...#....##
-#...#...##
-
-Tile 1579:
-###..##..#
-##....#..#
-..#..#..#.
-##.#....##
-#......#.#
-.##......#
-#.#.#....#
-#...#..#..
-#....#..##
-.#..#####.
-
-Tile 3881:
-.###.###..
-#..#......
-...#......
-.#..#...##
-#.#.#....#
-...#....##
-#..#......
-......##.#
-#..#......
-#.###..###
-
-Tile 3313:
-.#.#...###
-....##...#
-#.##.##.#.
-.#..#....#
-#...##....
-#...###...
-#.........
-...###....
-#....#....
-##.###...#
-
-Tile 3947:
-.#.#..####
-.........#
-....#.#...
-###..#...#
-#...##..#.
-##....##..
-#.#.......
-##....#..#
-..#.#.....
-#.#.######
-
-Tile 1381:
-.#...#..#.
-.##..#.#.#
-##..#.....
-#.......#.
-.........#
-........#.
-#....#....
-#.....#.##
-#..#...#..
-#...##.#.#
-
-Tile 1319:
-..#...#.#.
-.###.#...#
-...#..#..#
-####..#..#
-#..#.###..
-###...#.##
-..#.#.#..#
-#.##.#....
-#.......##
-.#...###.#
-
-Tile 2011:
-###...##..
-##......##
-##...#...#
-......#.#.
-#....#....
-.#..#....#
-#....#..##
-.#.#.##..#
-.#.#......
-##.###.#..
-
-Tile 3163:
-.##.#..###
-#........#
-.##......#
-.###.###..
-..#.....##
-##...#...#
-#...##...#
-#.......##
-.#.....#..
-...##..##.
-
-Tile 2441:
-####.##.#.
-#.....#..#
-.#..#..#..
-.##...#.#.
-..#..#.#.#
-..#..#..##
-#.#....###
-##........
-#...###..#
-#...######
-
-Tile 2111:
-.##.###..#
-.........#
+.#.##.#..#
+#.#.#.##.#
....#...##
-#.#......#
-#..#..####
-....#...#.
-.#...#.#.#
-#.........
-....#..#..
-.#.....###
-
-Tile 3931:
-####......
-###......#
-...##...#.
-#...###.#.
-#....#....
-...##.##.#
-#.#......#
-#.........
-....##....
-.....##.##
-
-Tile 3697:
-.#.#.##.##
-.....#...#
-#.........
-##.......#
-#........#
-#....##...
-#.#.....#.
-.......#..
-##...#....
-####.##.#.
-
-Tile 3709:
-.##.#.###.
-##..##....
-.#....#...
-##..##..##
-.#........
-..###.....
-#...#..#..
-.........#
-......##.#
-...##.##.#
-
-Tile 1619:
-.###..#.#.
-#....##...
-..##.##.##
-.....#....
-...#......
-#.....#...
-.###......
-..##...###
-#..#.....#
-##..#####.
-
-Tile 1777:
-..########
-#....#.#..
-..##..###.
-#.....#.#.
-..#......#
-#..#..#...
-#.......##
-#.##..#...
-##...#.#.#
-#..##.....
+...##..##.
+...#.#####
+.#.####.#.
+..#..###.#
+..##.#..#.
-Tile 2081:
-...#.##...
-#.#.##..##
-##....##.#
-#...##...#
-##........
-##..#.....
-#...##....
-#....#....
-.#..#....#
+Tile 1489:
##.#.#....
-
-Tile 3229:
-#...###.##
-#.#.##...#
-.....##..#
-#..#......
-#....#.#.#
-..........
-........##
-.#....#..#
-###.#...#.
-.###...#.#
-
-Tile 3767:
-#..#...###
-.#.#....#.
-#......#.#
-.........#
-#...##..##
-#......###
-.....#...#
-.#.......#
-#.#......#
-##.##.#.##
-
-Tile 3257:
-.#.#.###.#
-#.#.##....
-#.........
-.##......#
-..#....##.
-......#.#.
-#......#.#
-.........#
-##...##..#
-.#####...#
-
-Tile 3559:
-###..#..#.
-####......
-..##......
-#.#......#
-##....#..#
-#..#..##.#
-#.......#.
-#........#
-....#....#
-.#.###...#
-
-Tile 1427:
-##..######
-#....#.#.#
-..###..#.#
-.#..#...##
-.....#...#
-...#..#.#.
-##......#.
-.......#..
-..#...##.#
-##..#.#..#
-
-Tile 3853:
-##.##..###
-.#..#...#.
-##.##.....
-.....#..##
-#........#
-#..#....##
-#.#....#.#
-......##..
-##..#.....
-..#..##.#.
-
-Tile 3323:
-..##.#...#
-.#.....#..
-##...##...
-....#...#.
-#.#.##....
-##........
-#.....#..#
-.##....##.
-.#.......#
-.#####..#.
-
-Tile 1163:
-###..#.#.#
-#..#..#...
-#..##...##
-#.#...#.#.
-#...#....#
-#.#..#....
-......#...
-#....#.#..
-#....#.##.
-.#.......#
-
-Tile 1877:
+..##...#..
+.##..##...
+..#...#...
#####...#.
-.....#...#
-#.#...#...
-#...#.#...
-.........#
-....#...##
-..#..#....
-#.##.....#
-.#........
-####..#..#
-
-Tile 1571:
-.#.......#
-..........
-#......#.#
-..#..#....
-..#...#..#
-.......#.#
-##......##
-....##.#.#
-##...##.##
-.#.#.....#
-
-Tile 1093:
-###...#..#
-#.#..####.
-..#.....#.
-##.#.#....
-#.....#..#
-#.##......
-.####.....
-#.#.......
-#.##...#.#
-...##..##.
-
-Tile 2741:
-#....#.###
-.......#.#
-......#..#
-#.....#...
-.#....#..#
-.....#.#.#
-##.#...#..
-........#.
-#.....##..
-#.#..#.#.#
-
-Tile 2861:
-........#.
-.##.#....#
-..#..#....
-...#..#..#
-....#.#..#
-#....#...#
-#..###....
-#...####..
-#.......#.
-#...#.##.#
-
-Tile 3191:
-##..#.##..
-##.#....#.
-#.#..##.##
-#.##...###
-.......#.#
-#.#......#
-.#...#..#.
-#......#.#
-##.##....#
-#.#####..#
+#..#.#.#.#
+...#.#.#..
+##.#...##.
+..##.##.##
+###.##.#..
-Tile 3319:
-...#.#...#
-#.#.......
-#..#.##..#
-.##.#....#
-......#...
-#......#..
-.#..#.....
-........##
-..#..#..##
+Tile 2473:
#....####.
-
-Tile 3299:
-##....#..#
-#..#......
-.#.####.#.
-....##....
-.#.##.....
#..#.##...
-##......#.
-#.........
-#.......##
-.#.#....##
-
-Tile 3413:
-.#.....###
-#...#....#
-#........#
-..#..#..#.
-.##..#..#.
-#.....#...
-.##.#.##..
-#####.#.##
-..#..#####
-.#.#..###.
-
-Tile 2767:
-##.#.###.#
-..........
-.....##..#
-#....#....
-...#...#..
-#...##...#
-.......##.
-.....#.#.#
-....#....#
-#..#.#.##.
-
-Tile 2677:
-#.##....##
-#..##....#
-.......##.
-#...##..#.
-.........#
-.....#.#.#
-......#..#
-..##.....#
-#.#.....##
-#..#..#.#.
+#.##..#...
+######.#.#
+.#...#.#.#
+.#########
+.###.#..#.
+########.#
+##...##.#.
+..###.#.#.
-Tile 1489:
-##.#.#.##.
-.#...##.##
-.#..#..#..
-.....##..#
-#.##...#.#
+Tile 2971:
..#.#....#
-.##...##..
-##........
-#.........
-##.####.#.
-
-Tile 1657:
-#....#..##
-.#...#.#..
-#.#.......
-#.....#...
-.#..##.#.#
-#..#..#...
-##..#.##.#
-.##.#..#.#
-......#...
-#.#......#
-
-Tile 1483:
-#.###...#.
-#.........
-#..###...#
-#..#..###.
-#..##..###
-#.###.....
-.##.....##
-#...#.#..#
-#...#.....
-##..#...#.
-
-Tile 2897:
-#..#....#.
-.......###
-#.........
-.##..#....
-##...#...#
-...#..#...
-....#.....
-#....#...#
-#.#.##..##
-####....##
-
-Tile 2113:
-###...#.##
-#........#
-.##..#.#.#
-#..#......
-.#.......#
-....#....#
-#####...##
-#...#.#...
-....#..##.
-.##...#..#
+#...###...
+#.#.###...
+##.##..#..
+.#####..##
+.#..####.#
+#..#.#..#.
+..####.###
+..#.#.###.
+...#.#.#.#
-Tile 3301:
-##.#..#..#
-#.#..#....
-.#.#..##..
-.........#
-..#.....##
-#.........
-..........
-#.#.#..#.#
-####....#.
-.##.#.####
+Tile 2729:
+...#.#.#.#
+####.#....
+..#.#.....
+....#..#.#
+.##..##.#.
+.#.####...
+####.#.#..
+##.####...
+##..#.##..
+#.##...##.
-Tile 1549:
-.#.#...##.
-.........#
-.#.#...#..
-##........
-#.#....#..
-...#..#.#.
-#.......##
-#.....#...
-##......##
-#.#.#.#.##
+Tile 3079:
+#.#.#####.
+.#..######
+..#.......
+######....
+####.#..#.
+.#...#.##.
+#.#####.##
+..#.###...
+..#.......
+..#.###...
diff --git a/2020/20/solve.c b/2020/20/solve.c
index e6dd59d..f7d1b43 100644
--- a/2020/20/solve.c
+++ b/2020/20/solve.c
@@ -4,13 +4,24 @@
#include <time.h>
#define COUNT 10
+#define SIZE (10 * sizeof(int))
+#define INP_COUNT 144
+
+#define FLIP_X (0b11 << 0)
+#define FLIP_Y (0b11 << 2)
+#define ROT_ONE (0b11 << 4)
+#define ROT_TWO (0b11 << 6)
+#define ROT_THREE (0b11 << 8)
enum cnt_pos { T, R, B, L };
struct tile {
int id;
- int match[144];
+ int match[INP_COUNT];
+ int reversed; // Bitmap
+
+ char image[COUNT][COUNT];
int cnt[4]; // cnt_pos
int top[COUNT];
@@ -23,6 +34,27 @@ struct tile {
int left_rev[COUNT];
};
+void set_rotation(int *reversed, int pos_a, int pos_b, int is_rev)
+{
+ int rot = abs((pos_a + 1) - (pos_b + 1));
+
+ if (rot == 0)
+ return;
+
+ if (rot == 1 && !is_rev)
+ *reversed |= ROT_ONE;
+ else if (rot == 2 && !is_rev)
+ *reversed |= ROT_TWO;
+ else if (rot == 3 && !is_rev)
+ *reversed |= ROT_THREE;
+
+ if (is_rev && rot % 2 == 0) {
+ *reversed |= FLIP_X;
+ } else if (is_rev && rot % 2 == 1) {
+ *reversed |= FLIP_Y;
+ }
+}
+
void reverse(int dest[], int src[])
{
for (int i = 0; i < COUNT; i++) {
@@ -34,7 +66,7 @@ long part_one(FILE *fp)
{
long res = 1;
- struct tile tiles[144] = { 0 };
+ struct tile tiles[INP_COUNT] = { 0 };
int tile_cnt = 0;
char *line = NULL;
@@ -51,6 +83,7 @@ long part_one(FILE *fp)
y = 0;
} else {
struct tile *tile = &tiles[tile_cnt];
+ memcpy(tile->image, line, COUNT);
if (y == 0) {
for (int i = 0; i < COUNT; i++) {
tile->top[i] = line[i] == '#';
@@ -83,28 +116,24 @@ long part_one(FILE *fp)
for (int i = 0; i < tile_cnt; i++) {
struct tile *tile = &tiles[i];
// Find adjacent
- int *cur, *cur_rev, cnt;
+ int *cur, cnt;
for (int j = 0; j < 4; j++) { // TRBL
switch (j) {
case T:
cnt = tile->cnt[T];
cur = tile->top;
- cur_rev = tile->top_rev;
break;
case R:
cnt = tile->cnt[R];
cur = tile->right;
- cur_rev = tile->right_rev;
break;
case B:
cnt = tile->cnt[B];
cur = tile->bottom;
- cur_rev = tile->bottom_rev;
break;
case L:
cnt = tile->cnt[L];
cur = tile->left;
- cur_rev = tile->left_rev;
break;
default:
exit(1);
@@ -116,37 +145,50 @@ long part_one(FILE *fp)
if (cmp->id == tile->id)
continue;
- int match_cnt = 0;
+ int match_cnt = 0, reversed = 0;
if (cnt == cmp->cnt[T]) {
- if (!memcmp(cur, cmp->top, 40)) {
+ if (!memcmp(cur, cmp->top, SIZE)) {
+ set_rotation(&reversed, T, j, 0);
match_cnt++;
- } else if (!memcmp(cur_rev, cmp->top, 40)) {
+ } else if (!memcmp(cur, cmp->top_rev, SIZE)) {
+ set_rotation(&reversed, T, j, 1);
match_cnt++;
}
}
if (cnt == cmp->cnt[R]) {
- if (!memcmp(cur, cmp->right, 40)) {
+ if (!memcmp(cur, cmp->right, SIZE)) {
+ set_rotation(&reversed, R, j, 0);
match_cnt++;
- } else if (!memcmp(cur_rev, cmp->right, 40)) {
+ } else if (!memcmp(cur, cmp->right_rev, SIZE)) {
+ set_rotation(&reversed, R, j, 1);
+ //reversed |= REV_RIGHT;
match_cnt++;
}
}
if (cnt == cmp->cnt[B]) {
- if (!memcmp(cur, cmp->bottom, 40)) {
+ if (!memcmp(cur, cmp->bottom, SIZE)) {
+ set_rotation(&reversed, B, j, 0);
match_cnt++;
- } else if (!memcmp(cur_rev, cmp->bottom, 40)) {
+ } else if (!memcmp(cur, cmp->bottom_rev, SIZE)) {
+ set_rotation(&reversed, B, j, 1);
+ //reversed |= REV_BOTTOM;
match_cnt++;
}
}
if (cnt == cmp->cnt[L]) {
- if (!memcmp(cur, cmp->left, 40)) {
+ if (!memcmp(cur, cmp->left, SIZE)) {
+ set_rotation(&reversed, L, j, 0);
match_cnt++;
- } else if (!memcmp(cur_rev, cmp->left, 40)) {
+ } else if (!memcmp(cur, cmp->left_rev, SIZE)) {
+ set_rotation(&reversed, L, j, 1);
+ //reversed |= REV_LEFT;
match_cnt++;
}
}
tile->match[k] += match_cnt;
+ if (reversed != 0)
+ cmp->reversed = reversed;
}
}
}
@@ -154,13 +196,16 @@ long part_one(FILE *fp)
for (int i = 0; i < tile_cnt; i++) {
struct tile *tile = &tiles[i];
- int cnt = 0;
+ if (tile->reversed)
+ printf("%d: %x\n", tile->id, tile->reversed);
+ int cnt = 0, flipped = 0;
for (int j = 0; j < tile_cnt; j++) {
cnt += tile->match[j];
}
- if (cnt == 2)
+ if (cnt == 2) {
res *= tile->id;
+ }
}
return res;
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8174600
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+# Welcome!
+
+This repository mostly contains ugly overcomplicated spaghetti code solving the **Advent Of Code** questions in a reasonable amount of time and computing power.
+
+## Languages
+
+Most of my solutions are written in C but you may also find some in C#, JS or even Python (if I'm lazy).