My (attempted) solutions to the 2022 Advent of Code
Log | Files | Refs | README

```commit 183e8d1cf7dd876123f6fce26b231da0eef3f827
parent 9bb419b8c48ecd581ce0c3a431046cdcd325ae79
Date:   Sat, 14 Jan 2023 19:47:44 -0800

Solution to day 20, part 2.

Diffstat:
Msrc/day_20.jl | 23+++++++++++++++++------
```
```1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/day_20.jl b/src/day_20.jl
@@ -54,6 +54,13 @@ function moveelement!(coordfile::CoordFile, index::Int)
coordfile
end

+function mixelements!(coordfile::CoordFile)
+    for i = 1:length(coordfile)
+        moveelement!(coordfile, i)
+    end
+    coordfile
+end
+
function coordinates(coordfile::CoordFile)
# Find the zero
zeroloc = coordfile.indices[findfirst(x->x==0, coordfile.values)]
@@ -63,16 +70,20 @@ function coordinates(coordfile::CoordFile)
end

function part_1(input)
-    coordfile = CoordFile(input)
-    for i = 1:length(coordfile)
-        moveelement!(coordfile, i)
-    end
-    coordinates(coordfile)
+    input |> CoordFile |> mixelements! |> coordinates
end
@assert part_1(example) == 3
@info part_1(input)

function part_2(input)
-    nothing
+    coordfile = CoordFile(input)
+    for i = 1:length(coordfile)
+        coordfile.values[i] *= 811589153
+    end
+    for i = 1:10
+        mixelements!(coordfile)
+    end
+    coordinates(coordfile)
end
+@assert part_2(example) == 1623178306
@info part_2(input)
```