mirror of
https://github.com/fredrikr79/advent_of_code.git
synced 2026-04-20 17:00:42 +02:00
solve 2016/1 part 2 in uiua
This commit is contained in:
@@ -22,3 +22,17 @@ $Part₁
|
|||||||
#
|
#
|
||||||
# we can see many awesome pieces of functional and
|
# we can see many awesome pieces of functional and
|
||||||
# array oriented code!
|
# 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 ⧆.
|
||||||
|
|||||||
Reference in New Issue
Block a user