-# From https://mlochbaum.github.io/BQN/doc/control.html
-While ← {𝕩•_while_𝕨@}´
-
Prep←{
start⇐'S'=𝕩
end⇐'E'=𝕩
Flow←{
𝕩∨(«𝕩∧can_go_n)∨(»𝕩∧can_go_s)∨(«˘𝕩∧can_go_w)∨(»˘𝕩∧can_go_e)
}
- now←start
count←0
- While {𝕤,¬∨´⥊(now∧end)}‿{𝕤
- now↩Flow now
- count+↩1
- }
+ {count+↩1 ⋄ Flow 𝕩} •_while_ {¬∨´⥊(𝕩∧end)} start
count
}
-# From https://mlochbaum.github.io/BQN/doc/control.html
-While ← {𝕩•_while_𝕨@}´
-
Prep←{
start⇐'S'=𝕩
end⇐'E'=𝕩
Flow←{
𝕩∨(«𝕩∧can_go_n)∨(»𝕩∧can_go_s)∨(«˘𝕩∧can_go_w)∨(»˘𝕩∧can_go_e)
}
- now←start
count←0
- While {𝕤,¬∨´⥊(now∧end)}‿{𝕤
- now↩Flow now
- count+↩1
- }
+ {count+↩1 ⋄ Flow 𝕩} •_while_ {¬∨´⥊(𝕩∧end)} start
count
}