Last active
July 15, 2020 15:11
-
-
Save xpqz/281587aaa9618331396b73da3695f49b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⍝ https://adventofcode.com/2017/day/24 | |
DAY24←⍎¨¨'/'(≠⊆⊢)¨⊃⎕NGET'data/2017/24.txt'1 | |
Find←{(a b)←↓⍉↑↑⍺⋄⍺[(⍸⍵=a)∪⍸⍵=b]} | |
∇ r←components Day24p1 args;path;pins;strongest;c;bridge | |
(path pins)←args | |
strongest←path | |
:For c :In (components~path) Find pins | |
bridge←(components~c)Day24p1 (⊂(path,⊂c)),c {r←⍺~⍵⋄0=≢r:⊃⍺⋄⊃r} pins ⍝ Handle when both pins are equal | |
:If (+/∊bridge)>+/∊strongest | |
strongest←bridge | |
:EndIf | |
:EndFor | |
r←strongest | |
∇ | |
+/∊DAY24 Day24p1 (⊂0 0) 0 ⍝ Part 1: 1511 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment