Initial commit
This commit is contained in:
commit
f242d2b0df
420 changed files with 62521 additions and 0 deletions
1
2023/day16/.gitignore
vendored
Normal file
1
2023/day16/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
img/
|
10
2023/day16/Makefile
Normal file
10
2023/day16/Makefile
Normal file
|
@ -0,0 +1,10 @@
|
|||
anim.gif: day16.bqn
|
||||
mkdir -p img
|
||||
time bqn $<
|
||||
parallel 'pnmtopng {} > {.}.png' ::: img/*.pnm
|
||||
gifski -r 50 -o $@ img/*.png
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf img
|
||||
rm -f anim.gif
|
BIN
2023/day16/anim.gif
Normal file
BIN
2023/day16/anim.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
29
2023/day16/day16.bqn
Normal file
29
2023/day16/day16.bqn
Normal file
|
@ -0,0 +1,29 @@
|
|||
grid←>•FLines"input"
|
||||
|
||||
⟨PBM⟩←•Import"../../bqn-graphics/pnm.bqn"
|
||||
Mat←{1˙¨⌾(𝕩⊸⊑)(≢grid)⥊0}
|
||||
|
||||
Sim←{
|
||||
Step←{𝕨𝕊i‿v‿nv:
|
||||
{𝕊1: ("img/out"∾(1↓•Fmt 1e4+i)∾".pnm")•file.Chars PBM ¬Mat ⍷⊑¨v ; 0}𝕨
|
||||
nexts←{∧´(0⊸≤∧<⟜(≢grid))⊑𝕩}¨⊸/∾{𝕊p‿d:
|
||||
{
|
||||
𝕊'.'‿·: ⟨⟨p+d,d⟩⟩ ;
|
||||
𝕊'/'‿·: ⟨⟨p-⌽d,-⌽d⟩⟩ ;
|
||||
𝕊'\'‿·: ⟨⟨p+⌽d,⌽d⟩⟩ ;
|
||||
𝕊'|'‿1: ⟨⟨p+d,d⟩⟩ ;
|
||||
𝕊'|'‿0: ⟨⟨p+1‿0,1‿0⟩,⟨p-1‿0,-1‿0⟩⟩ ;
|
||||
𝕊'-'‿0: ⟨⟨p+d,d⟩⟩ ;
|
||||
𝕊'-'‿1: ⟨⟨p+0‿1,0‿1⟩,⟨p-0‿1,-0‿1⟩⟩
|
||||
}⟨p⊑grid,|⊑d⟩
|
||||
}¨nv
|
||||
⟨i+1,nv∾v,(¬nexts∊v)/nexts⟩
|
||||
}
|
||||
⍷⊑¨1⊑𝕨Step•_while_{0≠≠2⊑𝕩} 0‿⟨⟩‿⟨𝕩⟩
|
||||
}
|
||||
|
||||
•Show ≠ 1 Sim⟨0‿0,0‿1⟩
|
||||
|
||||
m‿n←≢grid
|
||||
starts←(⋈⟜1‿0¨0⊸∾¨↕m)∾(⋈⟜¯1‿0¨(m-1)⊸∾¨↕m)∾(⋈⟜0‿1¨∾⟜0¨↕n)∾(⋈⟜¯1‿0¨∾⟜(n-1)¨↕n)
|
||||
•Show ⌈´≠¨Sim¨starts
|
110
2023/day16/input
Normal file
110
2023/day16/input
Normal file
|
@ -0,0 +1,110 @@
|
|||
\|.................................../....\\/........................-.....|.|..-.....|\...................../
|
||||
|-.....|...\........|........................../-...../...--.|..\..........|......./.......-......|......./.-.
|
||||
.....\..../......-......|.........................-............|..../.....|.......-........../................
|
||||
........\..|.....|................/.......-\..............\...../....|............\....\......................
|
||||
-................\....-..........-................./.......//...............|..|...................-..........
|
||||
...................|..................................|.....|.....-....................../....|..\...\..\.|-..
|
||||
.......-.............../......\...................................-......../.......-.\|.................../...
|
||||
......\..................\.............-..........././....|-.....|......................../.-.....|......\....
|
||||
......-............-..................|..................../......-...|.....................\.................
|
||||
.........\..........-.......-./...-.../..\...../............................|................/....|...........
|
||||
.\....../....|...............|..../.......................-...................................-......|..\.....
|
||||
......................../...|.|........|.........|.....................-............../.-.../.-...............
|
||||
..|..-.-......|.......\....................-|.......|............-............................................
|
||||
.........................|.............-..........................-.\\......|.......|........-.........\......
|
||||
.../....-....\............/...................|........./..\.......\...........||.|......\.......\..-./.......
|
||||
.../..\.|..-....../.......................-.......-.......|/...........-.......-.......\......................
|
||||
..\...........-...-.......-.........|\....................../.-...........................\...........-.......
|
||||
..../.....||.....................-.........................................../............././................
|
||||
...................-..\................\................................................../.../.........../...
|
||||
\..................-.-..........//....|......./........-.............../.........\............................
|
||||
................/...|................../......./..............|.....|..............|..-...........|...........
|
||||
..../........-......\.|...-................./...................../|.........\................................
|
||||
...../...................-........|.......................-...\.............................\.../.............
|
||||
...../....-......................./..........................-............-........\......-.....\.../.\.\.....
|
||||
..|......-.\..........\........................\........../.........|...|............./............../-.......
|
||||
./..\-.......|.........|.\/........-........|.|...|..|....\...|.\.....|..|..-...............\.................
|
||||
..|../..........\................./...\...........|.....................-\..................-..|.........-..-.
|
||||
........./......||.....................................|..\.-|-................//..|-...|............-.\......
|
||||
........\..........\..........\......................./......................./......|........-.......|...-...
|
||||
.........././.....-...-..................-.|..........................-.............-......................./.
|
||||
.\..........|...........--....................\...-.\.........\......-.................../....|./..\..........
|
||||
......\.........\.|..||.....|...../........-..........|....|.....|....\..|..........\.........|...............
|
||||
...........\....-.../......-............/.............-......../.-...................-....|.....-\.......|....
|
||||
/.....................-.../...............-./....................../|....|.-...|.................\......../...
|
||||
................../.............|..........\..|..\....|....-...../...-.......\../......\....-...../.||........
|
||||
./-|.......\..../........../-....../......./...-....-................|............|.................-..../....
|
||||
.....................\....................|\.-../.......................|.......|.....-........-./..|.........
|
||||
..........|...\......\......................|./...........--................-..........-.......\...\-..\|.\..\
|
||||
.......\...-|................\....|......................../............................\..........-.\........
|
||||
./.......|................\...\........./.........|..................|.....-.......-.....|..|-............-...
|
||||
...|............/....-.\...........\...../..|..-...../..|.......-........\...-..............-.................
|
||||
.\-.....................-.........-.\.................|....-.....\....\.\\.//|.........\../.\.........../..-..
|
||||
......................................|\-........../..-.........-.........................................-|..
|
||||
........./.../..|.....-............./..\............./............../..............-\.......|....-....-.......
|
||||
.|............|......-/.-......-......-............-........|...../......\/....\../........|.......|..........
|
||||
.......|...........\.................-......................\..-...........................|..................
|
||||
|.........\..\.....-.../.........................-\.................|.........\...............................
|
||||
....-..........\.....././.............../..........-|...|...../........................-......|....-..........
|
||||
....................\.|.........\....|..........-.............\..........................|...........\........
|
||||
.............|.../......|.........../....................../....-..................../......................./
|
||||
.\...|....-../.............|............-..-.......||..........|............\/..................\...-.........
|
||||
........\/....-...................../..............-.....................-................................-...
|
||||
/-..........-......\.....|.....\....\............./..../...........|........-....\...............\.........|..
|
||||
...../..................\........................./.-...../.....\....-..-\.....\...|................./........
|
||||
......../......./.......................-.......-..\//...........-|.............../...\.\./..\................
|
||||
..............................|...................../......\..|.............\\......................./..-.....
|
||||
....\.....|..............|..................|...|.............|............--.......-..-.................../..
|
||||
....|.............../.\.............................................|...................../.........\.........
|
||||
.........\...../.../......\....................................................|.....-.../...\..........\.....
|
||||
-\............\.......................-...................-..../-........./.................................-.
|
||||
|.....\.....................\...................|..|..\....../.......\...|......\.............../-.-......|...
|
||||
.......|.........\.................|..-.............................\............................/............
|
||||
........................-.-........./..../.|.|.../..............\../....-..........|............../.....\\....
|
||||
...........\-...........||..........................................\.........|...........-...-...........-\..
|
||||
..................|................................./.................||.|..........|.....................|.|.
|
||||
....../.............................|.............................-/..|......./............................../
|
||||
./................../.|................................-...\.......|..................|............\-..|.....|
|
||||
\.....|.-...........-|.................../............\................../......................./.......\....
|
||||
.\.....................\.............|...............-......\...-........-...............-..........|../......
|
||||
.../..\...|........\\....\............-..|.....|........-/..........|....|.........\..|/...-.....-.\.../.....\
|
||||
......................../....-................................\..|.........................\..................
|
||||
..................\....-............\\\/..........|.................|...../..|.............|..................
|
||||
..|./.......|.....-............|...............|....|............-...\...........................\.\..........
|
||||
.....|-..\...\.........................|../...................../......\............\.........................
|
||||
-..-...........-............|......../................./......\.....-...|...............|.....................
|
||||
........|.......|.......\.|...\...../..\.../......................\.......\...\..................\....-..../..
|
||||
....-.-./.|...............-.-.............-.............../......./..........|.|../...............|.-.........
|
||||
...........\..-............../..........-..-../........../.....-/-|.........................-.............\...
|
||||
............................\.......//.|......../...........|\.....\...........-..-.......-/-.................
|
||||
..................................\..-..........|./..................../\............./............../........
|
||||
.....\..........\.......-............/.....................-.|....-......................./.|.................
|
||||
...............................|.......\........../.............-.....|.......\..\........................-...
|
||||
......\.........\\............../..-..............\...|..--......-.....\......./................./............
|
||||
.\.......\.....-...........-......................\........................../......../..../.-./..\........../
|
||||
.......|.......|........|...\\................./..../..\....\...\...........-.....................\.........-/
|
||||
....../........................................\..........-..|...............\....................|...-.......
|
||||
.|.|......./..........\........|......-......-............................|..|..\.........\.......-...........
|
||||
.....\.\-.-......\.........../.......\\..|..\........\/....\|.............................................\...
|
||||
.....................-.......................|............................................../.................
|
||||
..................\...-|............|........................-....../...........||............................
|
||||
........./............................./.....-....../.-...........-...........................................
|
||||
.........|...........-.........\......\.............\-.....|...-...|-.../..|.............\.....|....-.........
|
||||
.....|.....................................|.../........./|...|.|..................\..........................
|
||||
..\...........-.............|................//.............|........|.........../.\..............\...........
|
||||
..-\..-............|.\............../../.....||.../......-......|...-/...|..../../...................-/.\.....
|
||||
.......\.........../.\......\.........\...........-..............\..............|.........-..........-.-......
|
||||
../...................\|............................../...................|.............../.............-/....
|
||||
................/\.................|.....................\...|.\....................-.....-...................
|
||||
......................................................|................................\..\../...|.......|.-./
|
||||
.........//..|.......\.-...............|............................................................-.|.......
|
||||
........../.\........\............-./.\....../..//...........\..........|.\.\...|/\...-...\...................
|
||||
...-................/............../.............................................-../.-........\........../...
|
||||
...................-...............-.....-............/................./|.-.|...\.\...............-..-......|
|
||||
\....../.....|......\.........|../.....|......-..../....................-................/...\......\....../..
|
||||
...../...-.......................\..|\...-...\.|.........|.......|.................\.............-............
|
||||
...........................\/............................../...........-.......-..../......../......\...-.....
|
||||
.............................|.-......................-|\...--...............................\..............\.
|
||||
..............\.|......./..........\..........\/.../......|.....-../......../.....\...|-...........\........./
|
||||
.............../........\...................../...|......................-...|.|......./.....-................
|
||||
..-...............--..-...-............-..-\......................-.......|..............|........\.\.....-...
|
10
2023/day16/test
Normal file
10
2023/day16/test
Normal file
|
@ -0,0 +1,10 @@
|
|||
.|...\....
|
||||
|.-.\.....
|
||||
.....|-...
|
||||
........|.
|
||||
..........
|
||||
.........\
|
||||
..../.\\..
|
||||
.-.-/..|..
|
||||
.|....-|.\
|
||||
..//.|....
|
Loading…
Add table
Add a link
Reference in a new issue