twiddling

This commit is contained in:
rhiannon morris 2022-01-25 22:45:33 +01:00
parent 4682fe282f
commit f665be0180

29
aoc.bqn
View file

@ -112,30 +112,27 @@ aoc9 ⇐ {
################################################################################
Fst {0 𝕩? @; 𝕩}
At {1 ( 𝕩˙)¨/ 𝕨} # use ⎊ for default
At {1 ( 𝕩˙)¨/ 𝕨} # use ⎊ for default
aoc10 {
BadScore1 ')'3,']'57,'}'1197,'>'25137At0
BadScore BadScore1 {'!'c: c; @}
BadScore1 ')'3,']'57,'}'1197,'>'25137At
BadScore {'!'c: BadScore1 c; 0}
pairs Words "() [] {} <>"
Step {
'!' Fst 𝕨? 𝕨;
𝕨 𝕊 ')': '(' = Fst 𝕨? 1𝕨;
𝕨 𝕊 ']': '[' = Fst 𝕨? 1𝕨;
𝕨 𝕊 '}': '{' = Fst 𝕨? 1𝕨;
𝕨 𝕊 '>': '<' = Fst 𝕨? 1𝕨;
𝕩"([{<"? 𝕩𝕨;
'!'𝕩
'!' @ 𝕩? 𝕩;
𝕨 = pairs At@ 𝕩? 1𝕩;
𝕨 ¨pairs? 𝕨𝕩;
'!'𝕨
}
Find ""(Step˜´)
Find ""(Step´)
GoodScore1 '('1,'['2,'{'3,'<'4At
GoodScoreN {0 ((GoodScore1 ) + (5× ))´ 𝕩}
GoodScore GoodScoreN {'!' Fst 𝕩? ""; 𝕩}
GoodScore {'!' 𝕩? 0 ((GoodScore1 ) + (5× ))´ 𝕩; 0}
Middle ((÷2) ) (0¨/)
A +´ (BadScoreFind¨) •FLines
B Middle (GoodScoreFind¨) •FLines
A +´ BadScoreFind¨ •FLines
B Middle GoodScoreFind¨ •FLines
}