advent-of-code/2024/day17/day17.bqn

18 lines
939 B
BQN
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

in•FLines"input"
abc•ParseFloat¨12¨3in
Split((-˜+`׬)=)
p•ParseFloat¨','Split 9¯1in
Combo{𝕩(4)𝕨}
Step{
0n𝕊rabco: r+2,a÷ 2 abc Combo n,b,c,o;
1n𝕊rabco: r+2,a,b 32•bit._xor n,c,o;
2n𝕊rabco: r+2,a,8 | abc Combo n,c,o;
3n𝕊r0bco: r+2,a,b,c,o;
3n𝕊rabco: n,a,b,c,o;
4n𝕊rabco: r+2,a,b 32•bit._xor c,c,o;
5n𝕊rabco: r+2,a,b,c,o8| abc Combo n;
6n𝕊rabco: r+2,a,a÷ 2 abc Combo n,c,o;
7n𝕊rabco: r+2,a,b,a÷ 2 abc Combo n,o
}
Run{p𝕊abc: {(2(𝕩)p)Step 𝕩}•_while_{(𝕩)<p}0abc}
•Out 1(','•Fmt)¨¯1p Run abc