✨ Day 3!
This commit is contained in:
parent
6852dafe59
commit
c54bcf38bd
323
2020/3/input
Normal file
323
2020/3/input
Normal file
@ -0,0 +1,323 @@
|
||||
.........#..##..#..#........#..
|
||||
#...#..#..#...##.....##.##.#...
|
||||
....#..............#....#....#.
|
||||
#.#..#.....#...#.##..#.#.#.....
|
||||
........#..#.#..#.......#......
|
||||
.#........#.#..###.#....#.#.#..
|
||||
........#........#.......#.....
|
||||
...##..#.#.#........##.........
|
||||
#.#.##..###............#...#...
|
||||
............#....#.......###.##
|
||||
....##....##..#........#......#
|
||||
............#.#..........#.....
|
||||
#.#....#....##...#.....#.....#.
|
||||
......#.#.#...#.....###....#..#
|
||||
...........##..#.........#..#.#
|
||||
..#..#.................#..#..#.
|
||||
.#....###...#.......#.........#
|
||||
#.#.#.#...#......#.......#...#.
|
||||
.......#.#.#...#..............#
|
||||
...##.......#..##.#.......##...
|
||||
#.#.##....#..##..##..###...###.
|
||||
.#......##.##.#....#.##........
|
||||
..###.............##..##..#....
|
||||
.....#.#...........#..##..##...
|
||||
.###.#.#......#.....#........##
|
||||
...#.......#...##..#..#..#.....
|
||||
..............#.#..##.##..##..#
|
||||
#..#.#......#............#.....
|
||||
........#..#....#..............
|
||||
...#...#..............#.#####..
|
||||
...##......#........#.#...#....
|
||||
..##......#............#..#..#.
|
||||
....#.........#.#.#.....###.#..
|
||||
#....#........#........#....#.#
|
||||
.....#...#..##.....##...#.....#
|
||||
#...#.#.#...##..##.###.#.#.....
|
||||
......#.#..........#...#.##....
|
||||
..............##...#..#.......#
|
||||
........##.....#.....#.#....#..
|
||||
..............#..#..#...#.....#
|
||||
##......##.......##...#.#....#.
|
||||
.....#.............#.#.........
|
||||
#.........##..#..#.........##..
|
||||
..#..#.....#####.........##.#..
|
||||
.......##.#......#........#....
|
||||
#.................#.#...#....#.
|
||||
...#........#.###.##.##.....#..
|
||||
#.....##..#...##.#.#......#....
|
||||
.....#..#.#..........##..#.##..
|
||||
..###.............#..#..#...#..
|
||||
...###..#...#.....##..........#
|
||||
#.......#.#...#....#..##..#..#.
|
||||
.#..#.........#..............#.
|
||||
..######.....#....##......#....
|
||||
#..##...#......#..#.#....#.....
|
||||
.#...................#.#.....#.
|
||||
..#...#.#..#.#......#..#...#..#
|
||||
..##..##.#.##.........#.#.#....
|
||||
...#...#...........#..##.##...#
|
||||
#...#....#....#....#..#.##..#..
|
||||
..#.##....#....###..#..........
|
||||
#.#..##.#.#...##.#..#.##..#.#..
|
||||
#......##...#.#..........#..#..
|
||||
#.#...#..#...#.#.#..#........#.
|
||||
#.#.##.#..#...#..#.#.##........
|
||||
.....#......#........#..#......
|
||||
...#....#.#....#...............
|
||||
....#..###..#....#..#....#....#
|
||||
.#........###..........##.##.#.
|
||||
#.#......##....##...##.#......#
|
||||
#..##.##...#...........##.#.#..
|
||||
.#.....#.#...#.................
|
||||
##..........#..#....#.....#...#
|
||||
....#.#..........##..#.....#.##
|
||||
#.#..#..#..##..........#.......
|
||||
..#.#.###......................
|
||||
......##..##.....#..##.##....#.
|
||||
...#.......#.##....#......#....
|
||||
...#...#........#...#.#...#..##
|
||||
##...#....#.#...#.#.##..##...#.
|
||||
...#.....#...#...#....###.#..#.
|
||||
..#.#..#........#......#..##..#
|
||||
...#......#...#.#.##...##.#.#.#
|
||||
....#.#....#....#.....#.....##.
|
||||
.....#.#..##.#....##....##.....
|
||||
.#...###..#.....#............#.
|
||||
#..#.#.#..#..#...#....#...#....
|
||||
#.....#..#...#................#
|
||||
..........#..#.......#......#.#
|
||||
...#..#......#...#......#......
|
||||
.#.#.....#.#.#.#......#..#..#..
|
||||
.....#.........#.#.#.....##.#..
|
||||
.....#.#.....#..#..#..#.....###
|
||||
##....#......##....##.#....#.#.
|
||||
#####........#..........##.....
|
||||
.#...##...#...#.......#....#...
|
||||
#.#.##...##...##..##........#..
|
||||
#.#..............#.#...#...###.
|
||||
...#.....##..#.........#....#.#
|
||||
#.#....#....#..##.#..#...#.....
|
||||
..#....#.#..#...#...##.....#...
|
||||
....#...#......................
|
||||
..#...#.......#..#...##....#...
|
||||
.#........#...#.....##.##...#..
|
||||
#......#..............#..#..#..
|
||||
...........#.#..#.#.#....#....#
|
||||
.##..##.......#...#..#.....#..#
|
||||
...#.........#.........###..#..
|
||||
...#.##....#....#.....#.....#..
|
||||
.#.#.#.........#.#.#....#....#.
|
||||
...#..........##..#....#.#.....
|
||||
...#....##................#....
|
||||
#....##..#..#........##...#....
|
||||
#...#...##.#............#....#.
|
||||
##..#....#...#...............#.
|
||||
..........#.#...#..##..#.#.....
|
||||
..##...##..#....#.#......#.....
|
||||
.......#......#.#.....#.....##.
|
||||
#...###.....##..##....#.#....#.
|
||||
.###......#.....#.#............
|
||||
#.....#.....####.##....#..#....
|
||||
......###.............#......##
|
||||
.........##.......##..#..#..#..
|
||||
.#.......#....#...#...#.#......
|
||||
#...#..#...#........#...##..#..
|
||||
.#....#........#.........##..#.
|
||||
..............##.#...##..#.##.#
|
||||
.#....#...#....#......#..#.....
|
||||
#....##.#...#.#.....###..#....#
|
||||
#.......##.#..###..............
|
||||
#..#..#..#......#.#..#...#..#.#
|
||||
.......#.#.#..#..#...#..#......
|
||||
.#..#......#.....#......##..##.
|
||||
....#....#.......#.......#.#.##
|
||||
.......#.#................#...#
|
||||
#.#.....#.......#.#........#...
|
||||
.....#....##...#......#.....##.
|
||||
.#......#.#...#..#....#....#.##
|
||||
##...#.###.#....#..#....#.#...#
|
||||
....#.##..##.#.............#...
|
||||
#..#.............##.......#.#..
|
||||
##.#..#..#.#...........###...##
|
||||
.#.#.....#......###........#...
|
||||
#.#...#.#....##......#.#....#..
|
||||
#.........#..........#.........
|
||||
.......#....#...#..#.....#...##
|
||||
.......................#...#..#
|
||||
.###...........##...#........##
|
||||
#.#....######.#........#..##.#.
|
||||
..#.##.#...#.#.......#.##.##..#
|
||||
#.............###..#.##.#......
|
||||
...#..##......#...#..###.....#.
|
||||
..........#.....#..#...##..#...
|
||||
..##..........#.#..#.....#...#.
|
||||
...#.......#.....##.........#..
|
||||
#..#.#...#..#...###...#...#.#..
|
||||
#.##....#..#.#.......#..#..#...
|
||||
..#.##.#......#.#......#....#..
|
||||
..........#...##.....###.......
|
||||
...#...##..#......#...##.......
|
||||
....#........#.#.......#..###..
|
||||
.....#.#..........##.#..#..#.#.
|
||||
.............##.....#.#..##....
|
||||
...#...............##...#......
|
||||
....#......#..#....#...##..#...
|
||||
.##.#....#.#.....#.#.........#.
|
||||
.....#.###....#..###..#.#.....#
|
||||
.#.........##.........##...#...
|
||||
..#.....###....##..........#..#
|
||||
........#..#.#.#..#.......#..##
|
||||
..#.#..#.#............#.##.#..#
|
||||
.#....#.....#..#...#.......##..
|
||||
.#...........#.#..#..###.###...
|
||||
..#.....#..#........#.#........
|
||||
.#........##........#..#.##....
|
||||
......#.....##........##..#....
|
||||
.#..................##....#.#..
|
||||
.#..#.#..#.#...#........#......
|
||||
...#..##.#......#..#..........#
|
||||
....#.##...#....##.............
|
||||
#....#.##....##.###..#..#..#...
|
||||
..........#..#...##.##....#..#.
|
||||
.###.#.....#...#...#...#.......
|
||||
............#...............#.#
|
||||
#....#...#......#....#.#.#.#.##
|
||||
...#..........#.#.#.....###....
|
||||
#.#...##...#..#.....###...#....
|
||||
......#...#..#..#..#.##...##...
|
||||
...#..#.#....#...#.#.........##
|
||||
##....#..###.#.##.....##.......
|
||||
..#.#...#..##.......#.#.......#
|
||||
##......#...........#......#...
|
||||
.......#..###....###..##.#...##
|
||||
.........#.....#..#.......##..#
|
||||
.......#.##..#....#...#.#...#..
|
||||
#..#.#..................##.#..#
|
||||
...#..#..#.....#..#........#...
|
||||
...#.#..###..#.....##...#....#.
|
||||
..#..#......#...........#...#..
|
||||
#...##.##..###.......##........
|
||||
.#.....#..#....#.....#.##....#.
|
||||
#..#........#.#....#..#...#.###
|
||||
..#...#.#.#.....#.....#..#.....
|
||||
.##.............#.#......##...#
|
||||
.#....#####............#.....##
|
||||
#.###.......#.#...##.....#.....
|
||||
......#.##..#...#..#..##.#..##.
|
||||
......#.#...##.....#...#....##.
|
||||
....#............#...#...#....#
|
||||
.........##.#.#....#....#....##
|
||||
.#...##.#...#.......#.##....#.#
|
||||
#....#.#...#.#...#.#.#...#.....
|
||||
.#.#.........##..#..#..........
|
||||
.#.........#.#.....#..#.#..###.
|
||||
....##.#.#..........#..####....
|
||||
....#..#.#.#...#...#..#....#...
|
||||
..#.#...#...##.......#.#.#..#..
|
||||
...##...#......#.....#.#...#..#
|
||||
......#.###.#.......##...#...#.
|
||||
.....#.#.#......##..........###
|
||||
##.#.#.#..#....#...............
|
||||
.#.#.##.......#....#.#.....#..#
|
||||
.........#...#.#..#.......#....
|
||||
....#.####.#......#...#...##...
|
||||
#..#..#..#..#....#...##.....##.
|
||||
......####.#..##..#.....##.....
|
||||
##.#.........#........#..#.#...
|
||||
.#.#....#....#.......#.#....##.
|
||||
....#....#.......##..#.....#...
|
||||
.#......#..#....#.#............
|
||||
#..#.#.##.....#..#.#.#.#.#.##..
|
||||
.#.....#.....#...#..#.#...#.#..
|
||||
.#.#.##............#.#.#.#.#.#.
|
||||
.##..........#.....#...###.....
|
||||
#.#...#...#................#.#.
|
||||
##...#.##.....#.....#.#.##.....
|
||||
####.....##..........#......#..
|
||||
#.............#..............#.
|
||||
.###....#.#...#..#..#..#.......
|
||||
..#.#.....#...#..#..####.......
|
||||
...#.#..#........#..##..#..#.##
|
||||
.#........#..........#.#...##..
|
||||
.#.......#.#.#..#...#..#.#...##
|
||||
.#.....##......##..............
|
||||
......#..#.#.##...##.#.....#...
|
||||
.........#.#...##.....##....#.#
|
||||
.....##...#........#..#.#..#.#.
|
||||
.#.##..#.....##...#...###.#.#..
|
||||
...##...#...#..#.#..#..........
|
||||
##..............#...#...#.#..#.
|
||||
......#..#......#..#.....#...#.
|
||||
.......#...#..#....#.....#.....
|
||||
..##.....##..#.#........#......
|
||||
.###.#...#.....................
|
||||
..#...#.................#...#..
|
||||
#..#.##...####.............#...
|
||||
.##....#..####.......#.........
|
||||
#..#...###...#...#..#..##......
|
||||
....#.##.#.#.........#.....#..#
|
||||
.....#...#.....#.#.#.##.#...##.
|
||||
.............#........#.....#..
|
||||
...##.###.#....##.......#..#...
|
||||
#..#....#....#.#............#..
|
||||
.........#.##........##.....#..
|
||||
.........#.#.#..#..#.......#...
|
||||
.......#.#..#.......#.....#.#..
|
||||
##.#.....##...##.....#.#.......
|
||||
.#.#.#......##.##.#.........#..
|
||||
..#.##..###.....###.........##.
|
||||
.#......#..#..##...#.#...##.#.#
|
||||
......#.#............#.....#...
|
||||
###.#..#..#..#..#.##...#.......
|
||||
.#.#.##..###....#......##..###.
|
||||
#...#.#.#..#..#..##.#.##....#..
|
||||
..#...#...####...#......####.##
|
||||
..##.#.####........#..#......#.
|
||||
.#..#.......#...#.#.........#..
|
||||
........#.#....#..#####..#.....
|
||||
.#...........#..#..#..#...#....
|
||||
....#....#...#.................
|
||||
....##..#....##....#..#....#.##
|
||||
....#.##.....###...#...##.##...
|
||||
......##.#..##.#.#.#....#.#.#..
|
||||
##.#...###....#.#..#.#.###....#
|
||||
......###..#..#..........##...#
|
||||
..........#.##...##..#....##.#.
|
||||
.#...#.#..#.#.#..#.....#.......
|
||||
.#....#..#.#..#.#...##.#.#.....
|
||||
.##.....#...#..##.#........#...
|
||||
....#......#.........#....#..##
|
||||
.#..#.#.#.#..#..#.#.........#..
|
||||
.........#.....#...#....#......
|
||||
#..#..#........#...#.#.........
|
||||
...#.#.#...##.#.#...#..#......#
|
||||
#.#.#.#........#...#..#.....#..
|
||||
.###..#..#..###..#..#..........
|
||||
.....#......#.#..#...#.......#.
|
||||
##.##.........#.......##.......
|
||||
#...##.......#..#.#.......#....
|
||||
#..#..#.....#...#......#.......
|
||||
.#..#..#.##....#.#..#...#...#..
|
||||
.#...#.....#..#.........#..#...
|
||||
...#.#.#.......#....#..##.....#
|
||||
.........#..##.#..#..#.#.......
|
||||
#.##.....##..###..#..#..#.##...
|
||||
........#......#...##...###..##
|
||||
.##....##..#..#..###......#....
|
||||
............##......#...#..##..
|
||||
...##.......#......#...##.##..#
|
||||
...#..#..#.#...####.#.......#..
|
||||
..#.##..#....#......#.#.....#..
|
||||
..#.##..............#..##.....#
|
||||
.....##....#......#....#......#
|
||||
......#..#......#.........#..#.
|
||||
...#.##.###...###..#.##........
|
||||
..........####.#.##.....#..#.##
|
||||
#...##...........#...........##
|
||||
#.#..#.#....#.#..#....##......#
|
||||
.......#...#.....#......#.#.##.
|
||||
....#.##..##..........#..#.....
|
||||
#.#.#...#......#...#.....#.##.#
|
||||
........#.......#..##.....##...
|
||||
.....####.#....#.#.............
|
16
2020/3/trajectory.fish
Executable file
16
2020/3/trajectory.fish
Executable file
@ -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"
|
36
2020/3/trajectory2.fish
Executable file
36
2020/3/trajectory2.fish
Executable file
@ -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")
|
BIN
2020/random
BIN
2020/random
Binary file not shown.
Loading…
Reference in New Issue
Block a user