w:_%#i:,/0:"i/16.in" / width, input
(s;e):,/&'"SE"=\:i / start, end
S:999999 / "infinity"
m:S*"#"=i / mask for walls
d:((-w;w);(1;-1))+\:\:!u:w*w / directions
c:{m|/:x&(1000+|x)&&/'1+S^x@'d} / change
p:{&/c/@[;x;:;]'[2#,u#S;y]} / path[starting pos;direction]
:p1:(f:p[s;1000 0])@e / part 1: lowest score a reindeer could get
+//~^-1000 0?f-p1-p[e;0 0] / part 2: number of tiles the shortest distance from both endpoints
I am slowly learning from master rak... maybe someday I will write an elegant cellular automata solution. But not today.
For part 2, I get around reversing the directions by checking if the distance relative to the p1 answer is 0 or -1000. If it's 0, that means they meet in a straight line; if it's -1000, it means that one side has turned and the other hasn't (so hasn't added those 1000 points yet).
~/aoc24k/16.html