From 281615042fb381565bb0a43e2d3343c2cc1b73ea Mon Sep 17 00:00:00 2001 From: flifloo Date: Thu, 3 Dec 2020 12:40:39 +0100 Subject: [PATCH] Finish day 3 part 1 --- 2020/day 3/P1/input.txt | 323 +++++++++++++++++++++++++++ 2020/day 3/P1/toboggan_trajectory.py | 12 + 2 files changed, 335 insertions(+) create mode 100644 2020/day 3/P1/input.txt create mode 100644 2020/day 3/P1/toboggan_trajectory.py diff --git a/2020/day 3/P1/input.txt b/2020/day 3/P1/input.txt new file mode 100644 index 0000000..fd04fb1 --- /dev/null +++ b/2020/day 3/P1/input.txt @@ -0,0 +1,323 @@ +....#...............##...#...#. +#...#..#.....##.##.#.##....#... +...#.....#...#................. +#..#..#.......#...#.#.......... +...##..#.#..........##...#..... +........###.#.##..#............ +...###......##.#..#.#...#.#.... +......##..#.#....#...#......... +.................#......#...... +..............##....#.......... +#.....................#...#.#.# +.##..#............##...##.##..# +.....#.####...#..##......#.#..# +#.......#.#..#......##.#.#....# +.....##...###.#..........##.... +#...........#.##....##.....#..# +..###..##.##.....#....#........ +...#.#.#............#.#..#....# +#......#....#...##.#.#.#.#..#.. +.......#.#...#..#..#..##......# +.....#..#.............#..#...#. +##..#.##.....#........#........ +....##....#..#...........#...#. +.......#........##.......##.... +..##...#.......#........##.#... +..........#..#.....##........#. +..#..##..#............#........ +.#.#...#...#.......#......#.... +....#....#.....#.#.........###. +.............#...#....#..#.#... +##.#...#..#......#.#.##.....#.. +#...##.#..........#..#.#...#... +#####.......#.#.....#..#....... +#...#...#........#....#...#.... +......##.#..#..#............#.. +....#....#.......#...###....... +.#......##...#.##....#...#..... +..#....#...##.....#.#...##.#... +#.......#........#.####........ +#.##..#..#.........#.#........# +.#...#.#.#.#......#....#.#..#.. +#...####...##.##.#....#......## +..#...#......##........#.....#. +...#.#....##................... +...##................#......... +...##.....##........#....#..#.. +.........#..#.....#............ +.#..#.......................#.. +.#.........#..##........#.#.#.# +......#.....##..#.##...#..#.##. +..#..............##.......#.... +...............##....#...##..#. +###...#..###.........#...#..... +...#..#...#....#.....##........ +....#..##...#........#......... +..#......#.......#.....#..#.... +.#...........##.....###....#... +.#..#.....##.........##.....#.. +....##.#.....#................# +..#..#......#.#..#....#..##.... +#.....#...##............#...... +.#.............#....#.......#.. +#.........#..#...##.#...#.#.##. +...#......#..####....#.#.....#. +......#........#..........##.## +......##.#..##.##.....#........ +##.....#..##.##..#.......##.... +.##.........#...........#...#.. +.....#...###..#...#...........# +..........#.#......#.###.....#. +...#.............#.##......##.. +#.##.........#..###...........# +....#..##....#..#..#........### +...#........##.......##..#..#.. +...#......#..#.#............... +#......###....#.#..#.#..#....#. +#.#.####.#.........#..#.#.#.... +.....#....#...............#...# +.#........#......#.#...#....... +................#...#.....##... +.............#...####.......... +.................##....##.###.. +#................#......#...... +.###.#........#..##.....#..###. +..#.#..#...#..#.#...#.#.....#.# +.....#............#..##..#..#.# +#........##.#...#.....#........ +#.#.#..###......###............ +...#..#...........##...#.....#. +......#........#...#.#....#.... +....#..........#.#..#.#....##.. +...#.....##..#......#.#.##...#. +.........#..#................#. +..#....#.##.....#.......#...... +...#.....#.......##.##.....#... +#...#..............#..###..#... +#.#......#.#....#........##..#. +...#...##...##..#.........#.... +..#...#......##.#.#.#....##.... +#.......#.......#..#..#........ +.........#..#.....#....#.....## +.#......#.......#.#..#..#...#.# +..#....#.#..#.................. +#.....####..........#.#.....#.# +.#..#.#.#....#.#.....#.#....... +....##......#..#.....#.#.#...#. +...##...#......##.#....##.#.... +..#..##....#...#...........#... +.......#........#...##.#....... +#.#..#....##.#....##........... +.......#............#..##..##.. +#.#.#.....#....##.#.#.#.....#.. +##...#...#.......#..#...#.....# +##..##.##..........#........##. +..............#.....#..#..##... +.......#...#.........#....#.#.. +...#..#..#....#.#....##........ +..#.......#....#....##......... +#...#.....#..#.#...##....#..... +.....##..#..##..#.............. +.....##............#....#.#.... +..#.....#....##.#.....#..#..... +#...#..#..#......#.#.#..##..... +.............................## +#...#.#................#....#.# +.#.#.#....##......###..##...... +#.....#..#.##.#.#.##...###..... +.........#............##..#.... +.#..#...#....#.....#.#........# +...............#......#..#..... +...................###........# +.###..##..##.......#.#......... +#.........#......#....#.#...#.. +.#.#....#.......#.#..##...##... +.#.....#....##.......#.#.....#. +.........#...#....#.#.......... +....###..#..##.#...##....#..#.. +...#.#..##.#.........###.#..#.. +#...#...........#....#......... +....##...........#.#.#......### +#....#...........##..#......... +###....#.....#.......#....###.. +.#.......#....#.#.#.#......#.#. +........#...............#.#.#.. +....#.........#.....#...##.##.# +...#............#.............# +..........#..#................. +........#.....##............#.# +..#...##........#...#.....#.#.. +....#........#.#.#..........#.. +#.#...#...........#............ +....#.#...##...........#.....#. +...........#.#..#.....#........ +.....#..#..#..#.....#.#.....#.# +#.....#.......#.......#...#.... +#.........#....#.#........#..#. +...#..#.........#.....#..#..... +...#..#.............#.......... +.#.......#..........#.....#...# +.....#.#......#.......#....#... +...#.....#..#..##....##....#... +.#.#.#..#...#.....#....#....... +..##.#..........#.....#.#...... +..#..#.............#...##..##.. +.#.............#..#....##...#.. +..#...#.....#.................# +..##.......#.....#...#....#.... +.#..#.##.........#...#.#...#... +...##.......##..#.....##.##...# +........####.#.........#....... +..#.#...##.#..#..#.......##.#.. +.#..#............###..#..#..... +#.....#.#...#.#.......#........ +..........#......#.#...#...#... +..#......#..#..#.#...#......... +..###........#.#....#.#...##... +.#.....#..#.#......#........#.. +.#...#..#...#....#.......#..#.. +..#....#..#.....#.#........#... +#..#.#.........#..........#..#. +.#.....##....#.........#.#.#.#. +#.#...#.....#.#.#....#.#..#.... +.........#...................#. +..#.....#..##...#..........#.#. +..............#....#.........#. +.#....#.....#..............##.. +#...#...#.#........##.........# +....###....#.#....#.#.........# +.....#........#.....##......... +.#...##..##..#.........##...... +............#.....#........#... +..#....#.......#......#..#.#.#. +#.......#.#...........#..##.#.. +......#.##......#....#.......#. +.....#........#...###.....#.... +###..........#........#.#.#.... +.....#...#.#...#...#...##.....# +.##...#.#........#.#....#...... +......#.........#.....#.#...... +.....#.##.....###.#...#...##..# +.#.#.......##....#..#..#.##.... +.####...###.#.#.#.#............ +......#..##...#..........#.##.# +......#............#........... +.....#.#..#.......##...##...... +......#........#..#....#.#.#.#. +#..#..#.....#..#.....#.......#. +.#...#.....#..............#.... +.#....#..#.##.#............#### +..........#....#.##...#.#...... +...#.#.#.#.#.......#.........#. +##........#..##..#.........#... +..#......#...#..#.#.....#...... +..#.#......#...#...#.#......... +........................##..... +...#.##.#........#...#.......#. +..#.#......#....##........#.#.. +#......#.##........#..#......#. +.....#..#..#.............#..... +......#......#........#....#... +...#....###.....#..#.#....#.... +#.......................#....#. +..#...#...................#.... +....#..#.....##.#..#...#.....#. +...#.........#...#.......#..... +..#....#.....#...#...#.#####... +.....####......#...........#... +......#.#..........#...#.#.#..# +###..#.#....#..#............... +...#...###..#..#.#.#........... +.....#...#.##.#.#.###..##...... +.........#...........#....##.#. +....#..#......#................ +...........#..#..#...#.#....... +..#.....#......##.###.......... +.........#...................#. +..........#...#.#....##........ +..#...##....#....#.......#...## +#......#.....#...#...#...#..... +....##...#.#.......#.#...##.... +...#.....#....#.....#....#..... +#....##.....##..##..........##. +.....#.....#.#.#............... +.#.##....#.....#.#..#....#..##. +.....#.#.....##....#........... +.........#..#.......##..##..... +..#....##.....###...#....#.#... +............#......#.#...#..#.. +#..##......#.#.##....#.#....... +.#.#.....#...#.#.#....#.....#.. +#....#..#.#....#...#........... +......#.#.....#...#.#.#......#. +###..#....#.###.............#.. +..............#####........###. +..#..#.#.#.#......#......#..... +###.........#.#..........#..#.# +.#.........#...#......####..... +..#.......####..#....#...#..#.. +#.#..#.#...............#.#.#.#. +###....#.....##.#....#......##. +..#..#........#....###.#.#..... +...#.#..........#.....#...#.... +....#......##.#............#..# +...##...#.....#..##....#..#.#.# +.......#.....#..#....#....##.#. +.#..#....#..#......##....##...# +..#......#...#.#..###..#.##.... +#...#.....#......##...#.......# +.....#.#.....#...##............ +.#..##.##..#..##.#........#.... +....#.#......##...#.#.#.#..##.. +.#..............##........#.... +.##....#..#..#....#...#......#. +............###....##.......##. +..............####.....#....... +........##..##.#...#.......#... +....#..#.....##.......#####...# +.##..##..#.....#...#..#..#....# +##..#.#.#...........#.......... +#..#......#...#....#........... +...#..##.#..........#..#....... +........#.#.....#......##...... +.....#....#............#....... +.#.#..#....##......#.......###. +.#..#.#........#......#...##..# +...#....#......#..#........#.## +.........#..#...#..#.#.##...... +....###.#...........#...#...... +.##............#.......#..##... +##...#.#...............#.#...## +..#..#.....#.#..#..#........... +..#..#.##..#......#.##..#.#.... +..#...#......#.#...#....##.#... +...###....####......#....#...#. +.......##........#.....##....#. +.........##..........#...#..... +.....#............#.##.#....#.# +..........#...#....##.......... +....................#......#... +#......#..#...#.............##. +...........#................... +..#...#.........#.##.#..##.#... +#.#....#.#.....#............#.. +.#..#.....#.....####......#.#.. +#....#.......##..#...........#. +............#...#.....#..#.#... +#...........#...#####....#...#. +..........#...###..##.........# +#.....###............#..#..#.#. +...##.....#....#......#.....#.. +#....#.......#..#......###...#. +...##.##......##..##..........# +.......#.#..#.#..#.#.#.#..#..#. +..#..###...#....#.....#......#. +...#.........#..#.##.#.....###. +..#.........#.##.#..#..#..###.. +..####..#.........#.........#.# +..#.#...#.......#....##........ +.#......#.#.................... +..........#.......#.#..#..#.... +..#........#....#.#..#......... +..#.....#.............#....#... +##...#.........#.....#...#..... diff --git a/2020/day 3/P1/toboggan_trajectory.py b/2020/day 3/P1/toboggan_trajectory.py new file mode 100644 index 0000000..e8b0753 --- /dev/null +++ b/2020/day 3/P1/toboggan_trajectory.py @@ -0,0 +1,12 @@ +m = [m for m in open("input.txt").read().split("\n")[:-1]] + + + +i = (0,0) +t = 0 +while i[0] < len(m): + if m[i[0]][(i[1]%len(m[0]))] == "#": + t += 1 + i = (i[0]+1, i[1]+3) + +print(t)