From 850cfecc670e0f16a98e214632293478ff5eb09d Mon Sep 17 00:00:00 2001 From: fredrikr79 Date: Wed, 24 Sep 2025 00:21:05 +0200 Subject: [PATCH] solve 2016/1 part 2 in uiua --- 2016/1/main.ua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/2016/1/main.ua b/2016/1/main.ua index 4919dd5..5b60af4 100644 --- a/2016/1/main.ua +++ b/2016/1/main.ua @@ -22,3 +22,17 @@ $Part₁ # # we can see many awesome pieces of functional and # array oriented code! + +&fras $ input.txt +°/$"_, _" ⍜⇌↘₁ +∧◇(⍥(⊙⊂⟜⊣\+)⋕ ⍣( + ⍩⊙⍜⊢(×i) °(⊂@L) + | ⍩⊙⍜⊢(ׯi) °(⊂@R)) +)⊙i_0⊙[] +⌵+°ℂ ⊡⊸(⊢⍖=1⧆)⇌ ◌ +$Part₂ +# for this part, we only need to keep track of +# each intermediate step (all our positions). +# this by modifying the ⍥-loop to keep a log. +# then we can find the first reoccurring position +# using the new ⧆.