move prune onto same line, just fiddling now...

This commit is contained in:
Adam Millerchip 2024-12-23 08:08:49 +09:00
parent 237014dec8
commit 217e04c12b

View file

@ -8,12 +8,9 @@ defmodule Day22 do
def next(secret) do def next(secret) do
secret secret
|> then(fn secret -> (secret * 64) |> mix(secret) end) |> then(fn secret -> (secret * 64) |> mix(secret) |> prune() end)
|> prune() |> then(fn secret -> div(secret, 32) |> mix(secret) |> prune() end)
|> then(fn secret -> div(secret, 32) |> mix(secret) end) |> then(fn secret -> (secret * 2048) |> mix(secret) |> prune() end)
|> prune()
|> then(fn secret -> (secret * 2048) |> mix(secret) end)
|> prune()
end end
def mix(num, secret), do: Bitwise.bxor(secret, num) def mix(num, secret), do: Bitwise.bxor(secret, num)