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"
|
in←>•FLines"input"
|
||||||
n←≠in
|
|
||||||
freqs←∾"0aA"+¨↕¨10‿26‿26
|
freqs←∾"0aA"+¨↕¨10‿26‿26
|
||||||
as←∾{(≠⌜˜↕∘≠)⊸(/○⥊)(⊣+-)⌜˜/○⥊⟜(↕≢)𝕩=in}¨freqs
|
_antinodes←{f _r m:
|
||||||
•Show ≠⍷(∧´¨0⊸≤∧<⟜n¨¨)⊸/as
|
ns←∾{∾(≠⌜˜↕∘≠)⊸(/○⥊)F⌜˜/○⥊⟜(↕≢)𝕩=m}¨freqs
|
||||||
as2←∾{∾(≠⌜˜↕∘≠)⊸(/○⥊){(<𝕩)+(<𝕩-𝕨)×↕n}⌜˜/○⥊⟜(↕≢)𝕩=in}¨freqs
|
⍷(∧´0⊸≤∧<⟜(≠m)¨)¨⊸/ns
|
||||||
•Show ≠⍷(∧´¨0⊸≤∧<⟜n¨¨)⊸/as2
|
}
|
||||||
|
•Show ≠{⟨𝕩+𝕩-𝕨⟩}_antinodes in
|
||||||
|
•Show ≠{𝕩⊸+¨(𝕩-𝕨)⊸ר↕≠in}_antinodes in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue