solve 2016/1 part 2 in uiua

This commit is contained in:
2025-09-24 00:21:05 +02:00
parent d4267d6f51
commit 850cfecc67

View File

@@ -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 ⧆.