From c54bcf38bdbaa876b2d97f9a379f2d7984d9f2e6 Mon Sep 17 00:00:00 2001 From: Steph Date: Thu, 1 Dec 2022 21:02:00 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Day=203!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2020/3/input | 323 ++++++++++++++++++++++++++++++++++++++++ 2020/3/trajectory.fish | 16 ++ 2020/3/trajectory2.fish | 36 +++++ 2020/random | Bin 8568 -> 8536 bytes 4 files changed, 375 insertions(+) create mode 100644 2020/3/input create mode 100755 2020/3/trajectory.fish create mode 100755 2020/3/trajectory2.fish diff --git a/2020/3/input b/2020/3/input new file mode 100644 index 0000000..8a00870 --- /dev/null +++ b/2020/3/input @@ -0,0 +1,323 @@ +.........#..##..#..#........#.. +#...#..#..#...##.....##.##.#... +....#..............#....#....#. +#.#..#.....#...#.##..#.#.#..... +........#..#.#..#.......#...... +.#........#.#..###.#....#.#.#.. +........#........#.......#..... +...##..#.#.#........##......... +#.#.##..###............#...#... +............#....#.......###.## +....##....##..#........#......# +............#.#..........#..... +#.#....#....##...#.....#.....#. +......#.#.#...#.....###....#..# +...........##..#.........#..#.# +..#..#.................#..#..#. +.#....###...#.......#.........# +#.#.#.#...#......#.......#...#. +.......#.#.#...#..............# +...##.......#..##.#.......##... +#.#.##....#..##..##..###...###. +.#......##.##.#....#.##........ +..###.............##..##..#.... +.....#.#...........#..##..##... +.###.#.#......#.....#........## +...#.......#...##..#..#..#..... +..............#.#..##.##..##..# +#..#.#......#............#..... +........#..#....#.............. +...#...#..............#.#####.. +...##......#........#.#...#.... +..##......#............#..#..#. +....#.........#.#.#.....###.#.. +#....#........#........#....#.# +.....#...#..##.....##...#.....# +#...#.#.#...##..##.###.#.#..... +......#.#..........#...#.##.... +..............##...#..#.......# +........##.....#.....#.#....#.. +..............#..#..#...#.....# +##......##.......##...#.#....#. +.....#.............#.#......... +#.........##..#..#.........##.. +..#..#.....#####.........##.#.. +.......##.#......#........#.... +#.................#.#...#....#. +...#........#.###.##.##.....#.. +#.....##..#...##.#.#......#.... +.....#..#.#..........##..#.##.. +..###.............#..#..#...#.. +...###..#...#.....##..........# +#.......#.#...#....#..##..#..#. +.#..#.........#..............#. +..######.....#....##......#.... +#..##...#......#..#.#....#..... +.#...................#.#.....#. +..#...#.#..#.#......#..#...#..# +..##..##.#.##.........#.#.#.... +...#...#...........#..##.##...# +#...#....#....#....#..#.##..#.. +..#.##....#....###..#.......... +#.#..##.#.#...##.#..#.##..#.#.. +#......##...#.#..........#..#.. +#.#...#..#...#.#.#..#........#. +#.#.##.#..#...#..#.#.##........ +.....#......#........#..#...... +...#....#.#....#............... +....#..###..#....#..#....#....# +.#........###..........##.##.#. +#.#......##....##...##.#......# +#..##.##...#...........##.#.#.. +.#.....#.#...#................. +##..........#..#....#.....#...# +....#.#..........##..#.....#.## +#.#..#..#..##..........#....... +..#.#.###...................... +......##..##.....#..##.##....#. +...#.......#.##....#......#.... +...#...#........#...#.#...#..## +##...#....#.#...#.#.##..##...#. +...#.....#...#...#....###.#..#. +..#.#..#........#......#..##..# +...#......#...#.#.##...##.#.#.# +....#.#....#....#.....#.....##. +.....#.#..##.#....##....##..... +.#...###..#.....#............#. +#..#.#.#..#..#...#....#...#.... +#.....#..#...#................# +..........#..#.......#......#.# +...#..#......#...#......#...... +.#.#.....#.#.#.#......#..#..#.. +.....#.........#.#.#.....##.#.. +.....#.#.....#..#..#..#.....### +##....#......##....##.#....#.#. +#####........#..........##..... +.#...##...#...#.......#....#... +#.#.##...##...##..##........#.. +#.#..............#.#...#...###. +...#.....##..#.........#....#.# +#.#....#....#..##.#..#...#..... +..#....#.#..#...#...##.....#... +....#...#...................... +..#...#.......#..#...##....#... +.#........#...#.....##.##...#.. +#......#..............#..#..#.. +...........#.#..#.#.#....#....# +.##..##.......#...#..#.....#..# +...#.........#.........###..#.. +...#.##....#....#.....#.....#.. +.#.#.#.........#.#.#....#....#. +...#..........##..#....#.#..... +...#....##................#.... +#....##..#..#........##...#.... +#...#...##.#............#....#. +##..#....#...#...............#. +..........#.#...#..##..#.#..... +..##...##..#....#.#......#..... +.......#......#.#.....#.....##. +#...###.....##..##....#.#....#. +.###......#.....#.#............ +#.....#.....####.##....#..#.... +......###.............#......## +.........##.......##..#..#..#.. +.#.......#....#...#...#.#...... +#...#..#...#........#...##..#.. +.#....#........#.........##..#. +..............##.#...##..#.##.# +.#....#...#....#......#..#..... +#....##.#...#.#.....###..#....# +#.......##.#..###.............. +#..#..#..#......#.#..#...#..#.# +.......#.#.#..#..#...#..#...... +.#..#......#.....#......##..##. +....#....#.......#.......#.#.## +.......#.#................#...# +#.#.....#.......#.#........#... +.....#....##...#......#.....##. +.#......#.#...#..#....#....#.## +##...#.###.#....#..#....#.#...# +....#.##..##.#.............#... +#..#.............##.......#.#.. +##.#..#..#.#...........###...## +.#.#.....#......###........#... +#.#...#.#....##......#.#....#.. +#.........#..........#......... +.......#....#...#..#.....#...## +.......................#...#..# +.###...........##...#........## +#.#....######.#........#..##.#. +..#.##.#...#.#.......#.##.##..# +#.............###..#.##.#...... +...#..##......#...#..###.....#. +..........#.....#..#...##..#... +..##..........#.#..#.....#...#. +...#.......#.....##.........#.. +#..#.#...#..#...###...#...#.#.. +#.##....#..#.#.......#..#..#... +..#.##.#......#.#......#....#.. +..........#...##.....###....... +...#...##..#......#...##....... +....#........#.#.......#..###.. +.....#.#..........##.#..#..#.#. +.............##.....#.#..##.... +...#...............##...#...... +....#......#..#....#...##..#... +.##.#....#.#.....#.#.........#. +.....#.###....#..###..#.#.....# +.#.........##.........##...#... +..#.....###....##..........#..# +........#..#.#.#..#.......#..## +..#.#..#.#............#.##.#..# +.#....#.....#..#...#.......##.. +.#...........#.#..#..###.###... +..#.....#..#........#.#........ +.#........##........#..#.##.... +......#.....##........##..#.... +.#..................##....#.#.. +.#..#.#..#.#...#........#...... +...#..##.#......#..#..........# +....#.##...#....##............. +#....#.##....##.###..#..#..#... +..........#..#...##.##....#..#. +.###.#.....#...#...#...#....... +............#...............#.# +#....#...#......#....#.#.#.#.## +...#..........#.#.#.....###.... +#.#...##...#..#.....###...#.... +......#...#..#..#..#.##...##... +...#..#.#....#...#.#.........## +##....#..###.#.##.....##....... +..#.#...#..##.......#.#.......# +##......#...........#......#... +.......#..###....###..##.#...## +.........#.....#..#.......##..# +.......#.##..#....#...#.#...#.. +#..#.#..................##.#..# +...#..#..#.....#..#........#... +...#.#..###..#.....##...#....#. +..#..#......#...........#...#.. +#...##.##..###.......##........ +.#.....#..#....#.....#.##....#. +#..#........#.#....#..#...#.### +..#...#.#.#.....#.....#..#..... +.##.............#.#......##...# +.#....#####............#.....## +#.###.......#.#...##.....#..... +......#.##..#...#..#..##.#..##. +......#.#...##.....#...#....##. +....#............#...#...#....# +.........##.#.#....#....#....## +.#...##.#...#.......#.##....#.# +#....#.#...#.#...#.#.#...#..... +.#.#.........##..#..#.......... +.#.........#.#.....#..#.#..###. +....##.#.#..........#..####.... +....#..#.#.#...#...#..#....#... +..#.#...#...##.......#.#.#..#.. +...##...#......#.....#.#...#..# +......#.###.#.......##...#...#. +.....#.#.#......##..........### +##.#.#.#..#....#............... +.#.#.##.......#....#.#.....#..# +.........#...#.#..#.......#.... +....#.####.#......#...#...##... +#..#..#..#..#....#...##.....##. +......####.#..##..#.....##..... +##.#.........#........#..#.#... +.#.#....#....#.......#.#....##. +....#....#.......##..#.....#... +.#......#..#....#.#............ +#..#.#.##.....#..#.#.#.#.#.##.. +.#.....#.....#...#..#.#...#.#.. +.#.#.##............#.#.#.#.#.#. +.##..........#.....#...###..... +#.#...#...#................#.#. +##...#.##.....#.....#.#.##..... +####.....##..........#......#.. +#.............#..............#. +.###....#.#...#..#..#..#....... +..#.#.....#...#..#..####....... +...#.#..#........#..##..#..#.## +.#........#..........#.#...##.. +.#.......#.#.#..#...#..#.#...## +.#.....##......##.............. +......#..#.#.##...##.#.....#... +.........#.#...##.....##....#.# +.....##...#........#..#.#..#.#. +.#.##..#.....##...#...###.#.#.. +...##...#...#..#.#..#.......... +##..............#...#...#.#..#. +......#..#......#..#.....#...#. +.......#...#..#....#.....#..... +..##.....##..#.#........#...... +.###.#...#..................... +..#...#.................#...#.. +#..#.##...####.............#... +.##....#..####.......#......... +#..#...###...#...#..#..##...... +....#.##.#.#.........#.....#..# +.....#...#.....#.#.#.##.#...##. +.............#........#.....#.. +...##.###.#....##.......#..#... +#..#....#....#.#............#.. +.........#.##........##.....#.. +.........#.#.#..#..#.......#... +.......#.#..#.......#.....#.#.. +##.#.....##...##.....#.#....... +.#.#.#......##.##.#.........#.. +..#.##..###.....###.........##. +.#......#..#..##...#.#...##.#.# +......#.#............#.....#... +###.#..#..#..#..#.##...#....... +.#.#.##..###....#......##..###. +#...#.#.#..#..#..##.#.##....#.. +..#...#...####...#......####.## +..##.#.####........#..#......#. +.#..#.......#...#.#.........#.. +........#.#....#..#####..#..... +.#...........#..#..#..#...#.... +....#....#...#................. +....##..#....##....#..#....#.## +....#.##.....###...#...##.##... +......##.#..##.#.#.#....#.#.#.. +##.#...###....#.#..#.#.###....# +......###..#..#..........##...# +..........#.##...##..#....##.#. +.#...#.#..#.#.#..#.....#....... +.#....#..#.#..#.#...##.#.#..... +.##.....#...#..##.#........#... +....#......#.........#....#..## +.#..#.#.#.#..#..#.#.........#.. +.........#.....#...#....#...... +#..#..#........#...#.#......... +...#.#.#...##.#.#...#..#......# +#.#.#.#........#...#..#.....#.. +.###..#..#..###..#..#.......... +.....#......#.#..#...#.......#. +##.##.........#.......##....... +#...##.......#..#.#.......#.... +#..#..#.....#...#......#....... +.#..#..#.##....#.#..#...#...#.. +.#...#.....#..#.........#..#... +...#.#.#.......#....#..##.....# +.........#..##.#..#..#.#....... +#.##.....##..###..#..#..#.##... +........#......#...##...###..## +.##....##..#..#..###......#.... +............##......#...#..##.. +...##.......#......#...##.##..# +...#..#..#.#...####.#.......#.. +..#.##..#....#......#.#.....#.. +..#.##..............#..##.....# +.....##....#......#....#......# +......#..#......#.........#..#. +...#.##.###...###..#.##........ +..........####.#.##.....#..#.## +#...##...........#...........## +#.#..#.#....#.#..#....##......# +.......#...#.....#......#.#.##. +....#.##..##..........#..#..... +#.#.#...#......#...#.....#.##.# +........#.......#..##.....##... +.....####.#....#.#............. diff --git a/2020/3/trajectory.fish b/2020/3/trajectory.fish new file mode 100755 index 0000000..18f9800 --- /dev/null +++ b/2020/3/trajectory.fish @@ -0,0 +1,16 @@ +#!/usr/bin/fish + +set lines (cat input) +set pos 0 +set trees 0 +for val in $lines + set width (string length $val) + set char (string sub -s (math $pos + 1) -l 1 $val) + set pos (math "($pos + 3) % $width") + + if test "$char" = "#" + set trees (math $trees + 1) + end +end + +echo "total nr of trees is $trees" diff --git a/2020/3/trajectory2.fish b/2020/3/trajectory2.fish new file mode 100755 index 0000000..902e2ad --- /dev/null +++ b/2020/3/trajectory2.fish @@ -0,0 +1,36 @@ +#!/usr/bin/fish + +set lines (cat input) + +function traverse + set hv $argv[1] + set vv $argv[2] + + set pos 0 + set trees 0 + set i -1 + for val in $lines + set i (math $i + 1) + if test (math $i % $vv) -ne 0 + continue + end + + set width (string length $val) + set char (string sub -s (math $pos + 1) -l 1 $val) + set pos (math "($pos + $hv) % $width") + + if test "$char" = "#" + set trees (math $trees + 1) + end + end + + echo $trees +end + +set a (traverse 1 1) +set b (traverse 3 1) +set c (traverse 5 1) +set d (traverse 7 1) +set e (traverse 1 2) + +echo "Total number of things is ($a * $b * $c * $d * $e) " (math "$a * $b * $c * $d * $e") diff --git a/2020/random b/2020/random index d53ab32e46c3ee750a611d69aa8f5c858a6680f5..76548cbef09bc4bf093936fdf780b54d5dec1924 100755 GIT binary patch delta 2564 zcmZ`*eQZ-z6u+)NhguU+@r?xU@+0m4=W>Vs94Xv@4Y%_yvx16^E>z4 zbI(2Zp4X*n&(+4#6 zd9kAvmg=G~taBI%(cm98_(_*n`wR+p?AyFs*vuw6gH6qVL8ip62r=dCs(vgBmh$bK z2|ngUILw2ecJrHjls+I%6DDBn!yr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