about summary refs log tree commit diff
path: root/day11.bqn
blob: 03d4dcdbb6f8a57e91f2d967af199a443d785660 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
While ← {𝕩{π”½βŸπ”Ύβˆ˜π”½_𝕣_π”Ύβˆ˜π”½βŸπ”Ύπ•©}𝕨@}Β΄
d←>'0'-Λœβ€’FLines"day11"

Step ← {
  g←f←0Γ— x←𝕩+1
  While {𝕀 β‹„ f β‰’ f ∨ g ↩ (Β¬f) ∧ x>9 }β€Ώ{𝕀
    x +↩ (+Β΄+˝)βŽ‰2 3β€Ώ3↕{βŒ½β‰0βˆΎΛ˜π•©}⍟4 g
    f βˆ¨β†© g
  }
  x Γ— Β¬f∨g
}

β€’Out +Β΄{+Β΄β₯Š0=𝕩}Β¨ Step⍟(↕101) d
β€’Out 0 {∧´0=β₯Šπ•© ? 𝕨 ; (𝕨+1) π•Š Step 𝕩} d