Skip to content

Commit

Permalink
[Day 20] Format
Browse files Browse the repository at this point in the history
  • Loading branch information
goggle committed Apr 6, 2023
1 parent 04c86a2 commit a741817
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/day20.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ using AdventOfCode2022

mutable struct CircularList
value::Int
prev::Union{CircularList,Nothing}
next::Union{CircularList,Nothing}
prev::Union{CircularList, Nothing}
next::Union{CircularList, Nothing}
end

function day20(input::String = readInput(joinpath(@__DIR__, "..", "data", "day20.txt")))
cl, initial_order, zero = parse_input(input)
shuffle!(initial_order)
p1 = get_grove_number(zero, length(initial_order))

cl, initial_order, zero = parse_input(input; decryption_key=811589153)
cl, initial_order, zero = parse_input(input; decryption_key = 811589153)
for _ 1:10
shuffle!(initial_order)
end
Expand Down Expand Up @@ -56,19 +56,19 @@ function move!(src::CircularList, capacity::Int, n::Int)
src.prev = prev
end

function parse_input(input; decryption_key=1)
function parse_input(input; decryption_key = 1)
numbers = parse.(Int, split(rstrip(input), "\n")) .* decryption_key
circ = [CircularList(number, nothing, nothing) for number numbers]
zero = circ[end]
for i axes(circ,1)[1:end-1]
for i axes(circ, 1)[1:end-1]
circ[i].next = circ[i+1]
if circ[i].value == 0
zero = circ[i]
end
end
circ[end].next = circ[1]
circ[1].prev = circ[end]
for i axes(circ,1)[2:end]
for i axes(circ, 1)[2:end]
circ[i].prev = circ[i-1]
end

Expand Down

0 comments on commit a741817

Please sign in to comment.