(i;j):"\n\n"\1:"i/15.in"
m:(2#a),,'*|a:+'&'"#@O"=\:"\n"\i  / 0 = wall id, 1 = robot id, 2... = block ids
d:(,/-:\=2)(^:)_"v>^<"?j          / directions
s:{                               / step[map;dir] -> map
 p:&|/'~^x?\:y+/:,/x@             / ids -> pushed ids
 a:,/(~|/~:){(x y)^y}[p]\,1       / affected ids
 @[x;a;(y*~|/~a)+/:]}             / update map if valid move
p:+//100 1*+*'2_s/[;d]@           / part: step through then score
p m                               / part 1
p @[{a,0 1+/:a:1 2*/:x}'m;1;1#]   / part 2: stretch 2x wider

Yikes... quite slow too. The imperative threeven days strike again.


~/aoc24k/15.html