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

22 lines
631 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.

str•Import"../bqn-libs/strings.bqn"
stacksproc(@+210)str.Split•FChars•args
stacks¯1>(@+10)str.Split stacks
stacks' '/¨<˘((stacks)0100)/stacks
proc>str.ToNats¨¯1(@+10)str.Split proc
# •Show stacks
Move{
stacks𝕊n,x,y:
xy ¯1+
cratesnxstacks
stacks(n)(x)stacks
stacks(crates)(y)stacks;
𝕨𝕊x,y: 𝕨𝕊1,x,y
}
stacks1 (<stacks) Move` <˘(˘/1˘)proc
•Out ´¨¯1stacks1
stacks2 (<stacks) Move` <˘proc
•Out ´¨¯1stacks2