Initial commit

This commit is contained in:
Dimitri Lozeve 2024-11-12 21:43:32 +01:00
commit f242d2b0df
420 changed files with 62521 additions and 0 deletions

1
2023/day16/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
img/

10
2023/day16/Makefile Normal file
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

29
2023/day16/day16.bqn Normal file
View file

@ -0,0 +1,29 @@
grid>•FLines"input"
PBM•Import"../../bqn-graphics/pnm.bqn"
Mat{1˙¨(𝕩)(grid)0}
Sim{
Step{𝕨𝕊ivnv:
{𝕊1: ("img/out"(1•Fmt 1e4+i)".pnm")•file.Chars PBM ¬Mat ¨v ; 0}𝕨
nexts{´(0<(grid))𝕩}¨/{𝕊pd:
{
𝕊'.'·: p+d,d ;
𝕊'/'·: p-d,-d ;
𝕊'\'·: p+d,d ;
𝕊'|'1: p+d,d ;
𝕊'|'0: p+10,10,p-10,-10 ;
𝕊'-'0: p+d,d ;
𝕊'-'1: p+01,01,p-01,-01
}pgrid,|d
}¨nv
i+1,nvv,(¬nextsv)/nexts
}
¨1𝕨Step•_while_{02𝕩} 0𝕩
}
•Show 1 Sim00,01
mngrid
starts(10¨0¨m)(¯10¨(m-1)¨m)(01¨0¨n)(¯10¨(n-1)¨n)
•Show ´¨Sim¨starts

110
2023/day16/input Normal file
View file

@ -0,0 +1,110 @@
\|.................................../....\\/........................-.....|.|..-.....|\...................../
|-.....|...\........|........................../-...../...--.|..\..........|......./.......-......|......./.-.
.....\..../......-......|.........................-............|..../.....|.......-........../................
........\..|.....|................/.......-\..............\...../....|............\....\......................
-................\....-..........-................./.......//...............|..|...................-..........
...................|..................................|.....|.....-....................../....|..\...\..\.|-..
.......-.............../......\...................................-......../.......-.\|.................../...
......\..................\.............-..........././....|-.....|......................../.-.....|......\....
......-............-..................|..................../......-...|.....................\.................
.........\..........-.......-./...-.../..\...../............................|................/....|...........
.\....../....|...............|..../.......................-...................................-......|..\.....
......................../...|.|........|.........|.....................-............../.-.../.-...............
..|..-.-......|.......\....................-|.......|............-............................................
.........................|.............-..........................-.\\......|.......|........-.........\......
.../....-....\............/...................|........./..\.......\...........||.|......\.......\..-./.......
.../..\.|..-....../.......................-.......-.......|/...........-.......-.......\......................
..\...........-...-.......-.........|\....................../.-...........................\...........-.......
..../.....||.....................-.........................................../............././................
...................-..\................\................................................../.../.........../...
\..................-.-..........//....|......./........-.............../.........\............................
................/...|................../......./..............|.....|..............|..-...........|...........
..../........-......\.|...-................./...................../|.........\................................
...../...................-........|.......................-...\.............................\.../.............
...../....-......................./..........................-............-........\......-.....\.../.\.\.....
..|......-.\..........\........................\........../.........|...|............./............../-.......
./..\-.......|.........|.\/........-........|.|...|..|....\...|.\.....|..|..-...............\.................
..|../..........\................./...\...........|.....................-\..................-..|.........-..-.
........./......||.....................................|..\.-|-................//..|-...|............-.\......
........\..........\..........\......................./......................./......|........-.......|...-...
.........././.....-...-..................-.|..........................-.............-......................./.
.\..........|...........--....................\...-.\.........\......-.................../....|./..\..........
......\.........\.|..||.....|...../........-..........|....|.....|....\..|..........\.........|...............
...........\....-.../......-............/.............-......../.-...................-....|.....-\.......|....
/.....................-.../...............-./....................../|....|.-...|.................\......../...
................../.............|..........\..|..\....|....-...../...-.......\../......\....-...../.||........
./-|.......\..../........../-....../......./...-....-................|............|.................-..../....
.....................\....................|\.-../.......................|.......|.....-........-./..|.........
..........|...\......\......................|./...........--................-..........-.......\...\-..\|.\..\
.......\...-|................\....|......................../............................\..........-.\........
./.......|................\...\........./.........|..................|.....-.......-.....|..|-............-...
...|............/....-.\...........\...../..|..-...../..|.......-........\...-..............-.................
.\-.....................-.........-.\.................|....-.....\....\.\\.//|.........\../.\.........../..-..
......................................|\-........../..-.........-.........................................-|..
........./.../..|.....-............./..\............./............../..............-\.......|....-....-.......
.|............|......-/.-......-......-............-........|...../......\/....\../........|.......|..........
.......|...........\.................-......................\..-...........................|..................
|.........\..\.....-.../.........................-\.................|.........\...............................
....-..........\.....././.............../..........-|...|...../........................-......|....-..........
....................\.|.........\....|..........-.............\..........................|...........\........
.............|.../......|.........../....................../....-..................../......................./
.\...|....-../.............|............-..-.......||..........|............\/..................\...-.........
........\/....-...................../..............-.....................-................................-...
/-..........-......\.....|.....\....\............./..../...........|........-....\...............\.........|..
...../..................\........................./.-...../.....\....-..-\.....\...|................./........
......../......./.......................-.......-..\//...........-|.............../...\.\./..\................
..............................|...................../......\..|.............\\......................./..-.....
....\.....|..............|..................|...|.............|............--.......-..-.................../..
....|.............../.\.............................................|...................../.........\.........
.........\...../.../......\....................................................|.....-.../...\..........\.....
-\............\.......................-...................-..../-........./.................................-.
|.....\.....................\...................|..|..\....../.......\...|......\.............../-.-......|...
.......|.........\.................|..-.............................\............................/............
........................-.-........./..../.|.|.../..............\../....-..........|............../.....\\....
...........\-...........||..........................................\.........|...........-...-...........-\..
..................|................................./.................||.|..........|.....................|.|.
....../.............................|.............................-/..|......./............................../
./................../.|................................-...\.......|..................|............\-..|.....|
\.....|.-...........-|.................../............\................../......................./.......\....
.\.....................\.............|...............-......\...-........-...............-..........|../......
.../..\...|........\\....\............-..|.....|........-/..........|....|.........\..|/...-.....-.\.../.....\
......................../....-................................\..|.........................\..................
..................\....-............\\\/..........|.................|...../..|.............|..................
..|./.......|.....-............|...............|....|............-...\...........................\.\..........
.....|-..\...\.........................|../...................../......\............\.........................
-..-...........-............|......../................./......\.....-...|...............|.....................
........|.......|.......\.|...\...../..\.../......................\.......\...\..................\....-..../..
....-.-./.|...............-.-.............-.............../......./..........|.|../...............|.-.........
...........\..-............../..........-..-../........../.....-/-|.........................-.............\...
............................\.......//.|......../...........|\.....\...........-..-.......-/-.................
..................................\..-..........|./..................../\............./............../........
.....\..........\.......-............/.....................-.|....-......................./.|.................
...............................|.......\........../.............-.....|.......\..\........................-...
......\.........\\............../..-..............\...|..--......-.....\......./................./............
.\.......\.....-...........-......................\........................../......../..../.-./..\........../
.......|.......|........|...\\................./..../..\....\...\...........-.....................\.........-/
....../........................................\..........-..|...............\....................|...-.......
.|.|......./..........\........|......-......-............................|..|..\.........\.......-...........
.....\.\-.-......\.........../.......\\..|..\........\/....\|.............................................\...
.....................-.......................|............................................../.................
..................\...-|............|........................-....../...........||............................
........./............................./.....-....../.-...........-...........................................
.........|...........-.........\......\.............\-.....|...-...|-.../..|.............\.....|....-.........
.....|.....................................|.../........./|...|.|..................\..........................
..\...........-.............|................//.............|........|.........../.\..............\...........
..-\..-............|.\............../../.....||.../......-......|...-/...|..../../...................-/.\.....
.......\.........../.\......\.........\...........-..............\..............|.........-..........-.-......
../...................\|............................../...................|.............../.............-/....
................/\.................|.....................\...|.\....................-.....-...................
......................................................|................................\..\../...|.......|.-./
.........//..|.......\.-...............|............................................................-.|.......
........../.\........\............-./.\....../..//...........\..........|.\.\...|/\...-...\...................
...-................/............../.............................................-../.-........\........../...
...................-...............-.....-............/................./|.-.|...\.\...............-..-......|
\....../.....|......\.........|../.....|......-..../....................-................/...\......\....../..
...../...-.......................\..|\...-...\.|.........|.......|.................\.............-............
...........................\/............................../...........-.......-..../......../......\...-.....
.............................|.-......................-|\...--...............................\..............\.
..............\.|......./..........\..........\/.../......|.....-../......../.....\...|-...........\........./
.............../........\...................../...|......................-...|.|......./.....-................
..-...............--..-...-............-..-\......................-.......|..............|........\.\.....-...

10
2023/day16/test Normal file
View file

@ -0,0 +1,10 @@
.|...\....
|.-.\.....
.....|-...
........|.
..........
.........\
..../.\\..
.-.-/..|..
.|....-|.\
..//.|....