## ~pmikkelsen/aoc2023

8f63d82efa21bc450552b1853643f20ce27b677e — Peter Mikkelsen 7 months ago
Solve day 11
2 files changed, 156 insertions(+), 0 deletions(-)

A Day11.aplf
A input/day11
A Day11.aplf => Day11.aplf +16 -0
@@ 0,0 1,16 @@
r←Day11;cols;factor;galaxies;input;rows;space
input←↑⊃⎕NGET'input/day11' 1
space←input≠'#'
rows←⍸∧/space
cols←⍸∧⌿space
galaxies←⍸~space
r←⍬
:For factor :In 2 1000000
r,←2÷⍨+⌿,∘.{
(dy dx)←|⍺-⍵
(miny minx)←⍺⌊⍵
map←(minx+⍳dx)∊cols
map,←(miny+⍳dy)∊rows
+⌿(~map)+map×factor
}⍨galaxies
:EndFor

A input/day11 => input/day11 +140 -0
@@ 0,0 1,140 @@
.......#...........................................................................#........................................................
.............#...........#..................#.............................................................#..............#.......#..........
..................................................................#.........#......................................#........................
.................#...........................................................................................................#..............
.............................................................#..............................................................................
......................#.....................................................................#............................................#..
.....#...........................................#..........................................................................................
............................#..........................................#...............................#....................................
...........#......................................................................................#......................#..................
....................................................#.....#................................................#......................#.........
#..................................................................#.............#...........................................#..............
......................................#..................................................#...............................................#..
.................................#..........................................................................................................
...............#........#..............................................#...............................................#....................
.......#....................................................................................................................................
............................................................................#...................#..................#.......#.........#......
...................#......................#......#.......#.......#..........................................................................
............#...........................................................................#................#..................................
.....................................................#..................#................................................................#..
.............................#.....#..........................................................................#...................#.........
...#.......................................................#...............................#................................................
............................................#........................................................#......................................
...................................................................#..................................................................#.....
..........................................................................................................................#.................
#.......................#............................#.......................................#..............................................
..........................................#.................#.....................................#................................#........
..................#............................................................#........................#..............#....................
............................................................................................................................................
......#........................................................................................#.............................#..............
...............#........................#.........#.....#......#...................#..............................#.........................
.........................#.....#..........................................#.................................................................
.................................................................................................................................#..........
...........................................................#..................................................#..........#............#.....
.............#.................................................................#............................................................
.....................#............#..............#.......................................#..................................................
#..........................#...........................#..................................................#.................................
.............................................................#....................................................................#.......#.
......................................................................................................................#.....................
............#..................#...........#........#...............................#..............#...........#............................
.......#..............................#.....................................................................................................
........................#...............................................................#..............#.................#.............#....
.#..........................................................................................................#...............................
.........................................................#.....................#.................................................#..........
..........................................#..........................................#...........................#.........................#
.....#..........................#.................#..........#........#.....................................................................
..........#...........#.................................................................................#...................................
.............................................................................................................................#.......#......
..........................................................#.................#............#..................................................
.....................................................#..........................................#...........#...............................
.......................................#...............................#.............................#......................................
..................................#...............................................#........................................#.............#..
.......#.......#.......#..........................................#.........................................................................
.............................................#...............#..............................................................................
............................#................................................................#..............................................
........................................................#..................#.............................#........................#.........
...................................................................................................#..........#.............................
......#............................................................................#....................................#..................#
..................#.....#...............#.....#......#...................................#.....................................#............
..................................................................#...........#.............................................................
#.............#..........................................#...............#...................#.........#....................................
........#.............................................................................................................#.............#.......
......................#......................................#............................................................................#.
..............................#....................................................#........................................................
............................................................................................................................................
...............#.............................................................................................#..............................
........................#............#............................#................................................................#........
...#.....................................................#................#..............#...................................#..............
.............................................#..............................................................................................
...........................#................................................................................................................
.....................................................#......#....................................................#.....#....................
.....#....................................#.....#...........................#...................#...........................................
..............#.....................#...................................................................#...................................
#........................................................................................#..................................................
.....................#........................................................................................#.............................
..........................#.......................#..................................................................................#......
.........#................................................#.........#.......................................................#...............
...............................#................................................................#.....#.....................................
...................#..........................#.................#..................#..............................................#.........
......#......#..............................................................................................................................
............................#......................................................................#........#...............................
....................................................................................................................#.......................
................................................#...........#.................#........................#....................................
.................#..........................................................................................................................
..........................#......................................................................................#..........#..........#....
#...............................................................................................#.....................#.....................
............#......................#...................#.................................#.........................................#........
............................................................................................................................................
....................................................................#.......................................................................
.....#........................................#...........................................................#...................#.............
..........................................................#..................................#..............................................
.............................#............................................#.................................................................
......................#............................................................................................................#........
..#.....................................................................................................................................#...
...........#..........................#............................................................................#........................
..............................................#.................#....................#...............#........#.............................
...........................#...........................#......................................#...........................#.....#...........
.........................................................................................................#..................................
.........#......#................................................................................................#........................#.
...#.....................................................................#..............#...................................................
.............................#......#...............................#................................................#......................
.........................................#............................................................................................#.....
.....................#............................#............#.................#...........................#...............#..............
.............#..........................................#...................................#...............................................
..#.............................#...........................................#.....................#................#........................
...........................................#...........................#.................................................#..............#...
........#...........................#.......................#.......................#.......................................................
...........................#.............................................................................#.......................#..........
............................................................................................................................................
...............#...............................................................................#..........................................#.
............................................................................................................................................
#...............................................#......#.......#...............#............................................................
.........#.................................#...........................................................#....................................
......................................#............................#...............................................#........................
......................#.........#.............................................................................#.............................
....................................................................................#............#..........................................
..........................................................................#...............#.................................................
...........#.....#................................#.........................................................................#...............
..................................................................#.......................................#.........................#.......
.........................#................................#........................................................#........................
........#...................................................................................#......#....................................#...
...............................................................#...............#............................................................
.............................................#.........................#.....................................#..............................
...................#...............#........................................................................................................
..........................#..............................#....................................#..................................#..........
...........#.....................................................................#.....#....................................................
...#.................................................#...............................................#...........#...........#..............
...............#........................#................................................................................................#..
....................#..............................................#.....................................#..................................
..................................#.....................#................................#..................................................
............................................#...................................................#.............#.............................
........................................................................................................................#.....#......#.....#
...........................................................#..................#......................#......................................
...................#.........#....................................#.........................#...............................................
....................................................#...............................................................#.......................
.............#........................#....................................................................................#................
....................................................................................#...................................................#...
.......#................................................#................#..................................................................
.#.................................................................#..............................................................#.........
...................#.....#...................................................................#.........#.........#..........................
............................................#.....#............#..................................#.........#................#..............