2024 day 8 cleaned up
This commit is contained in:
parent
54a991f4f2
commit
1065943b0f
1 changed files with 6 additions and 5 deletions
|
@ -1,7 +1,8 @@
|
|||
in←>•FLines"input"
|
||||
n←≠in
|
||||
freqs←∾"0aA"+¨↕¨10‿26‿26
|
||||
as←∾{(≠⌜˜↕∘≠)⊸(/○⥊)(⊣+-)⌜˜/○⥊⟜(↕≢)𝕩=in}¨freqs
|
||||
•Show ≠⍷(∧´¨0⊸≤∧<⟜n¨¨)⊸/as
|
||||
as2←∾{∾(≠⌜˜↕∘≠)⊸(/○⥊){(<𝕩)+(<𝕩-𝕨)×↕n}⌜˜/○⥊⟜(↕≢)𝕩=in}¨freqs
|
||||
•Show ≠⍷(∧´¨0⊸≤∧<⟜n¨¨)⊸/as2
|
||||
_antinodes←{f _r m:
|
||||
ns←∾{∾(≠⌜˜↕∘≠)⊸(/○⥊)F⌜˜/○⥊⟜(↕≢)𝕩=m}¨freqs
|
||||
⍷(∧´0⊸≤∧<⟜(≠m)¨)¨⊸/ns
|
||||
}
|
||||
•Show ≠{⟨𝕩+𝕩-𝕨⟩}_antinodes in
|
||||
•Show ≠{𝕩⊸+¨(𝕩-𝕨)⊸ר↕≠in}_antinodes in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue