diff options
Diffstat (limited to 'day02.bqn')
-rw-r--r-- | day02.bqn | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/day02.bqn b/day02.bqn new file mode 100644 index 0000000..ae2c60d --- /dev/null +++ b/day02.bqn @@ -0,0 +1,16 @@ +d←•FLines"day02" +c←⊑¨d +n←'0'-˜¯1⊑¨d + +pos←+´n×'f'=c +aim←+`n×1-˜"ufd"⊐c +depth←⊑⌽aim +•Out pos×depth + +depth2←+´n×aim×'f'=c +•Out pos×depth2 + +{ # Golfed: +•Out (p←+´m←n×c=9)×⊑⌽a←+`(n←'0'-˜¯1⊑¨d)×1-˜4‿9‿6⊐c←≠¨d←•FLines"day02" +•Out p×+´a×m +} |