advent-of-code/2023/day03/day03.bqn
2024-11-12 21:46:18 +01:00

12 lines
495 B
BQN
Raw 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.

digits'0'+10
nminput>•FLines"input"
sympos>m(÷˜|)/¬inputdigits'.'
digpos(0)¨/ <˘¨{+`1<|+´˘+`𝕩} >m(÷˜|)/inputdigits
near{´1=´¨|¨(<˘sympos)-𝕩}¨digpos
nums•ParseFloat¨input¨digpos
•Show +´near/nums
gearpos<˘>m(÷˜|)/input='*'
nearnums{(1=´¨´¨|¨¨𝕩-¨¨digpos)/nums}¨gearpos
•Show +´×´¨(2=)¨/nearnums