35 lines
1.1 KiB
BQN
35 lines
1.1 KiB
BQN
# no
|
||
# Day11 ⇐ {
|
||
# input ← >{·‿s‿o‿p‿t‿f:
|
||
# ⟨⥊•BQN '‿'⍟(','⊸=)¨ 18↓s
|
||
# •BQN∘(«23↓o)⎊⊢ ('+'=⊑23↓o)◶×‿+ ⊢
|
||
# •BQN 21↓p, •BQN 29↓t, •BQN 30↓f⟩
|
||
# }∘(6⊸↑)¨ 7 Chunk •FLines 𝕩
|
||
# start ← >⋈⟜0¨⊏˘input ⋄ info ← 1↓˘input ⋄ mod ← ×´1⊑˘info
|
||
# Go ← {n‿d𝕊𝕩:
|
||
# Turn ← {i𝕊m:
|
||
# x‿n ← i⊏m ⋄ O‿p‿t‿f ← i⊏info
|
||
# y ← (0⊸=p⊸|)⊸⊔ mod| ⌊d÷˜ O x
|
||
# l‿r ← ⊑⎊⟨⟩⟜y¨↕2
|
||
# (∾⟜l)⌾(f‿0⊸⊑) (∾⟜r)⌾(t‿0⊸⊑) ⟨⟨⟩,n+≠x⟩⌾(i⊸⊏) m
|
||
# }
|
||
# Round ← {𝕩 Turn´ ⌽↕≠𝕩}
|
||
# ×´2↑∨1⊏˘ Round⍟n 𝕩
|
||
# }
|
||
# 20‿3 Go start
|
||
# # ⟨10⋆5,1⟩ Go start
|
||
# }
|
||
|
||
Day12 ⇐ {
|
||
map ← >•FLines 𝕩
|
||
# start‿end ← {⊑(𝕩⊸= /○⥊ ↕∘≢)map}¨ "SE"
|
||
start‿end ← "SE"⊐˜⥊map
|
||
map {'S':0; 'E':25; 𝕩-'a'}¨↩
|
||
i_h ← ⥊ (↕∘≢∾¨⊢) map
|
||
Adj ← {∞⍟¬ (1=+´2↑r)∧∧´1≥(r←|𝕨-𝕩)}
|
||
a ← Adj⌜˜ i_h
|
||
a {0⍟(=´𝕩)𝕨}¨⟜(↕≢)↩
|
||
a
|
||
}
|
||
•Show Day12 ⊑•args
|
||
|