Skip to content

Commit

Permalink
Day 18 solution.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayfoad committed Dec 18, 2018
1 parent f1b21a2 commit 6eb7994
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
7 changes: 7 additions & 0 deletions p18.dyalog
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
⎕IO0
p⎕NGET'p18.txt' 1
f{(='.')2<+/='|':'|' (='|')2<+/='#':'#' (='#')(1=+/='#')0=+/='|':'.' }
g{f¯2{,}3 3}
v{×/+/'|#'.=,} value
v g10p part 1
v {()n:n+(()-n)|1E9-n (,)g }p part 2
50 changes: 50 additions & 0 deletions p18.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
|#.....|...#|#...|......|..||.##..##..|||#|....|..
.#.#.#..|.#..||.##....|#.|.##....##..#|...#..#.|..
#..##...|#.#||#....##...#....##..#.#.|...|.#.....#
.|.|.|..||#.....#.#..#..........#.||.#..|.|#.|.#..
#..|.......#||.........||.#...#|.....||.|#...|#..#
|.#|.....#|##.|||.#|#|.#..|..#..#..||...||.......#
|..#|..#||#..#.......#.#|.#...........#.##........
.....||.#.#|..#...|.#...#.#..........|...|.#....#|
.|.##|.|...#.|#..|.||.#.|.#.|.#..#.|#|...|##..##|.
...#....#...|.|.##.###.#|...#..........||...|...||
|#..##|..|...#..#...||......|.|.#..#...#|..|#|..##
#.|..#..#.....|.##..#|.....##......|...||..#..#...
|#.....|#||#.....|.##|.#.#.#.#.|#.#...|#|#..||....
...##|....|.|..|#.||||.##.#..#..###..|.#.#|.#...|.
..||.||..|....|.#.|....#..|#.|#..#.|.|.|||......#.
...#.#|..#|.###.##..|...#.||#....||....||..#....|.
.#|.|......#.##.....#.....#.#..|..|#|#..#......|..
.#.|.|##...||#...#|....|||.....##......|...|#|...|
|...|##.|....|.....|||.#.##..|.##|#....#...|....#.
..#.||.##.#...|#...#|##.||##.#.....|...|...#|.|...
#.#.|..#.#.###...|..||..|...||.|..#.#...#..|..|...
.#.|.#|.|.##.|..##.#|.#.##...|||...#|..|.#.##...|.
....##|..|.#.....|.|.#..|#..#|..#.#....#..#......#
|...||..|.#..|..#.###||.......###.....#..........|
.|.||....|#..#.|...|.#..##...|.........#..#|.|.#..
.|...|.|#|.||#...#...#.|..|...|||#....||#..|....#.
|......#......#.|#.....|#||.#...#...##....#..#....
.......|#.|#...|.#.....#..||....#..#...|.#.#||.###
##.#.#|..||##.#|.|.#......###.|...#|...#|.##....||
..#.|...#.|.........|#.......|.....#.|..#..|...|#|
|||...|..|#|...##.......|....||.|.##..|.....#.#|..
#.#...|..##.##.#...#..#.|.##...|##.#|..|..#.....|.
.#|..#.|#|.#......#..#...||.........#.#...##||....
#|##..#....#.....|..................#..|.#|...#..|
.....#..........#.|..#..|.....|#....||###.|......|
.....#.|.....|...#..#....|#...|#.#|##....#..||...|
.#|..||.#.|.....#...|##.#|.|.#...|..#|##.|..|.#...
.......|.||..||..#..|#.#|....#..####.##...#....#..
#..||..|..........|.#.......#..|..#|.|.....#.....#
#...#....#|.##..#...#..|#.#..|||.#.#..||...|.|..#.
...#.##..||.#.#....|...|..#.#..|||...#......|#..#.
.|..#||..|##..|.|.#.|..#..|....|..||.#|.|...#.|#..
.....###..|||...||.|.|.|.|#..##|..##....###.||..|.
.|....#.#|#.......|.|..#......###.|.|..|.......#..
.#.#.....|.|....#..|...|.|..#.|##....#..||...#...|
|#|..#|...####....#.#.|.|.|..#..##|##..#..|||#..|.
#|#...#|....|....###...|.....|..|....|.....##..|..
.|...#...##|.|##..|...|.|#...|.#.|.....|..|....||.
#...#||.#....|..|..#.|#.||.|.|#...#.|.#...||#.#.||
....|...||...#..#|..|##.#.|.##.#|...#||.|.|.#..#|#

0 comments on commit 6eb7994

Please sign in to comment.