diff --git a/2020/day 3/P2/input.txt b/2020/day 3/P2/input.txt new file mode 100644 index 0000000..fd04fb1 --- /dev/null +++ b/2020/day 3/P2/input.txt @@ -0,0 +1,323 @@ +....#...............##...#...#. +#...#..#.....##.##.#.##....#... +...#.....#...#................. +#..#..#.......#...#.#.......... +...##..#.#..........##...#..... +........###.#.##..#............ +...###......##.#..#.#...#.#.... +......##..#.#....#...#......... +.................#......#...... +..............##....#.......... +#.....................#...#.#.# +.##..#............##...##.##..# +.....#.####...#..##......#.#..# +#.......#.#..#......##.#.#....# +.....##...###.#..........##.... +#...........#.##....##.....#..# +..###..##.##.....#....#........ +...#.#.#............#.#..#....# +#......#....#...##.#.#.#.#..#.. +.......#.#...#..#..#..##......# +.....#..#.............#..#...#. +##..#.##.....#........#........ +....##....#..#...........#...#. +.......#........##.......##.... +..##...#.......#........##.#... +..........#..#.....##........#. +..#..##..#............#........ +.#.#...#...#.......#......#.... +....#....#.....#.#.........###. +.............#...#....#..#.#... +##.#...#..#......#.#.##.....#.. +#...##.#..........#..#.#...#... +#####.......#.#.....#..#....... +#...#...#........#....#...#.... +......##.#..#..#............#.. +....#....#.......#...###....... +.#......##...#.##....#...#..... +..#....#...##.....#.#...##.#... +#.......#........#.####........ +#.##..#..#.........#.#........# +.#...#.#.#.#......#....#.#..#.. +#...####...##.##.#....#......## +..#...#......##........#.....#. +...#.#....##................... +...##................#......... +...##.....##........#....#..#.. +.........#..#.....#............ +.#..#.......................#.. +.#.........#..##........#.#.#.# +......#.....##..#.##...#..#.##. +..#..............##.......#.... +...............##....#...##..#. +###...#..###.........#...#..... +...#..#...#....#.....##........ +....#..##...#........#......... +..#......#.......#.....#..#.... +.#...........##.....###....#... +.#..#.....##.........##.....#.. +....##.#.....#................# +..#..#......#.#..#....#..##.... +#.....#...##............#...... +.#.............#....#.......#.. +#.........#..#...##.#...#.#.##. +...#......#..####....#.#.....#. +......#........#..........##.## +......##.#..##.##.....#........ +##.....#..##.##..#.......##.... +.##.........#...........#...#.. +.....#...###..#...#...........# +..........#.#......#.###.....#. +...#.............#.##......##.. +#.##.........#..###...........# +....#..##....#..#..#........### +...#........##.......##..#..#.. +...#......#..#.#............... +#......###....#.#..#.#..#....#. +#.#.####.#.........#..#.#.#.... +.....#....#...............#...# +.#........#......#.#...#....... +................#...#.....##... +.............#...####.......... +.................##....##.###.. +#................#......#...... +.###.#........#..##.....#..###. +..#.#..#...#..#.#...#.#.....#.# +.....#............#..##..#..#.# +#........##.#...#.....#........ +#.#.#..###......###............ +...#..#...........##...#.....#. +......#........#...#.#....#.... +....#..........#.#..#.#....##.. +...#.....##..#......#.#.##...#. +.........#..#................#. +..#....#.##.....#.......#...... +...#.....#.......##.##.....#... +#...#..............#..###..#... +#.#......#.#....#........##..#. +...#...##...##..#.........#.... +..#...#......##.#.#.#....##.... +#.......#.......#..#..#........ +.........#..#.....#....#.....## +.#......#.......#.#..#..#...#.# +..#....#.#..#.................. +#.....####..........#.#.....#.# +.#..#.#.#....#.#.....#.#....... +....##......#..#.....#.#.#...#. +...##...#......##.#....##.#.... +..#..##....#...#...........#... +.......#........#...##.#....... +#.#..#....##.#....##........... +.......#............#..##..##.. +#.#.#.....#....##.#.#.#.....#.. +##...#...#.......#..#...#.....# +##..##.##..........#........##. +..............#.....#..#..##... +.......#...#.........#....#.#.. +...#..#..#....#.#....##........ +..#.......#....#....##......... +#...#.....#..#.#...##....#..... +.....##..#..##..#.............. +.....##............#....#.#.... +..#.....#....##.#.....#..#..... +#...#..#..#......#.#.#..##..... +.............................## +#...#.#................#....#.# +.#.#.#....##......###..##...... +#.....#..#.##.#.#.##...###..... +.........#............##..#.... +.#..#...#....#.....#.#........# +...............#......#..#..... +...................###........# +.###..##..##.......#.#......... +#.........#......#....#.#...#.. +.#.#....#.......#.#..##...##... +.#.....#....##.......#.#.....#. +.........#...#....#.#.......... +....###..#..##.#...##....#..#.. +...#.#..##.#.........###.#..#.. +#...#...........#....#......... +....##...........#.#.#......### +#....#...........##..#......... +###....#.....#.......#....###.. +.#.......#....#.#.#.#......#.#. +........#...............#.#.#.. +....#.........#.....#...##.##.# +...#............#.............# +..........#..#................. +........#.....##............#.# +..#...##........#...#.....#.#.. +....#........#.#.#..........#.. +#.#...#...........#............ +....#.#...##...........#.....#. +...........#.#..#.....#........ +.....#..#..#..#.....#.#.....#.# +#.....#.......#.......#...#.... +#.........#....#.#........#..#. +...#..#.........#.....#..#..... +...#..#.............#.......... +.#.......#..........#.....#...# +.....#.#......#.......#....#... +...#.....#..#..##....##....#... +.#.#.#..#...#.....#....#....... +..##.#..........#.....#.#...... +..#..#.............#...##..##.. +.#.............#..#....##...#.. +..#...#.....#.................# +..##.......#.....#...#....#.... +.#..#.##.........#...#.#...#... +...##.......##..#.....##.##...# +........####.#.........#....... +..#.#...##.#..#..#.......##.#.. +.#..#............###..#..#..... +#.....#.#...#.#.......#........ +..........#......#.#...#...#... +..#......#..#..#.#...#......... +..###........#.#....#.#...##... +.#.....#..#.#......#........#.. +.#...#..#...#....#.......#..#.. +..#....#..#.....#.#........#... +#..#.#.........#..........#..#. +.#.....##....#.........#.#.#.#. +#.#...#.....#.#.#....#.#..#.... +.........#...................#. +..#.....#..##...#..........#.#. +..............#....#.........#. +.#....#.....#..............##.. +#...#...#.#........##.........# +....###....#.#....#.#.........# +.....#........#.....##......... +.#...##..##..#.........##...... +............#.....#........#... +..#....#.......#......#..#.#.#. +#.......#.#...........#..##.#.. +......#.##......#....#.......#. +.....#........#...###.....#.... +###..........#........#.#.#.... +.....#...#.#...#...#...##.....# +.##...#.#........#.#....#...... +......#.........#.....#.#...... +.....#.##.....###.#...#...##..# +.#.#.......##....#..#..#.##.... +.####...###.#.#.#.#............ +......#..##...#..........#.##.# +......#............#........... +.....#.#..#.......##...##...... +......#........#..#....#.#.#.#. +#..#..#.....#..#.....#.......#. +.#...#.....#..............#.... +.#....#..#.##.#............#### +..........#....#.##...#.#...... +...#.#.#.#.#.......#.........#. +##........#..##..#.........#... +..#......#...#..#.#.....#...... +..#.#......#...#...#.#......... +........................##..... +...#.##.#........#...#.......#. +..#.#......#....##........#.#.. +#......#.##........#..#......#. +.....#..#..#.............#..... +......#......#........#....#... +...#....###.....#..#.#....#.... +#.......................#....#. +..#...#...................#.... +....#..#.....##.#..#...#.....#. +...#.........#...#.......#..... +..#....#.....#...#...#.#####... +.....####......#...........#... +......#.#..........#...#.#.#..# +###..#.#....#..#............... +...#...###..#..#.#.#........... +.....#...#.##.#.#.###..##...... +.........#...........#....##.#. +....#..#......#................ +...........#..#..#...#.#....... +..#.....#......##.###.......... +.........#...................#. +..........#...#.#....##........ +..#...##....#....#.......#...## +#......#.....#...#...#...#..... +....##...#.#.......#.#...##.... +...#.....#....#.....#....#..... +#....##.....##..##..........##. +.....#.....#.#.#............... +.#.##....#.....#.#..#....#..##. +.....#.#.....##....#........... +.........#..#.......##..##..... +..#....##.....###...#....#.#... +............#......#.#...#..#.. +#..##......#.#.##....#.#....... +.#.#.....#...#.#.#....#.....#.. +#....#..#.#....#...#........... +......#.#.....#...#.#.#......#. +###..#....#.###.............#.. +..............#####........###. +..#..#.#.#.#......#......#..... +###.........#.#..........#..#.# +.#.........#...#......####..... +..#.......####..#....#...#..#.. +#.#..#.#...............#.#.#.#. +###....#.....##.#....#......##. +..#..#........#....###.#.#..... +...#.#..........#.....#...#.... +....#......##.#............#..# +...##...#.....#..##....#..#.#.# +.......#.....#..#....#....##.#. +.#..#....#..#......##....##...# +..#......#...#.#..###..#.##.... +#...#.....#......##...#.......# +.....#.#.....#...##............ +.#..##.##..#..##.#........#.... +....#.#......##...#.#.#.#..##.. +.#..............##........#.... +.##....#..#..#....#...#......#. +............###....##.......##. +..............####.....#....... +........##..##.#...#.......#... +....#..#.....##.......#####...# +.##..##..#.....#...#..#..#....# +##..#.#.#...........#.......... +#..#......#...#....#........... +...#..##.#..........#..#....... +........#.#.....#......##...... +.....#....#............#....... +.#.#..#....##......#.......###. +.#..#.#........#......#...##..# +...#....#......#..#........#.## +.........#..#...#..#.#.##...... +....###.#...........#...#...... +.##............#.......#..##... +##...#.#...............#.#...## +..#..#.....#.#..#..#........... +..#..#.##..#......#.##..#.#.... +..#...#......#.#...#....##.#... +...###....####......#....#...#. +.......##........#.....##....#. +.........##..........#...#..... +.....#............#.##.#....#.# +..........#...#....##.......... +....................#......#... +#......#..#...#.............##. +...........#................... +..#...#.........#.##.#..##.#... +#.#....#.#.....#............#.. +.#..#.....#.....####......#.#.. +#....#.......##..#...........#. +............#...#.....#..#.#... +#...........#...#####....#...#. +..........#...###..##.........# +#.....###............#..#..#.#. +...##.....#....#......#.....#.. +#....#.......#..#......###...#. +...##.##......##..##..........# +.......#.#..#.#..#.#.#.#..#..#. +..#..###...#....#.....#......#. +...#.........#..#.##.#.....###. +..#.........#.##.#..#..#..###.. +..####..#.........#.........#.# +..#.#...#.......#....##........ +.#......#.#.................... +..........#.......#.#..#..#.... +..#........#....#.#..#......... +..#.....#.............#....#... +##...#.........#.....#...#..... diff --git a/2020/day 3/P2/toboggan_trajectory.py b/2020/day 3/P2/toboggan_trajectory.py new file mode 100644 index 0000000..dd7a196 --- /dev/null +++ b/2020/day 3/P2/toboggan_trajectory.py @@ -0,0 +1,17 @@ +from functools import reduce + + +m = [m for m in open("input.txt").read().split("\n")[:-1]] + + +tl = [] +for i in ((1,1), (1, 3), (1, 5), (1, 7), (2,1)): + j = (0, 0) # y, x + t = 0 + while j[0] < len(m): + if m[j[0]][(j[1] % len(m[0]))] == "#": + t += 1 + j = (j[0] + i[0], j[1] + i[1]) + tl.append(t) + +print(reduce(lambda y, x: y*x, tl))