tangled
alpha
login
or
join now
hauleth.dev
/
advent-of-code
3
fork
atom
this repo has no description
3
fork
atom
overview
issues
pulls
pipelines
chore: cleanup 11.2022
hauleth.dev
3 years ago
85f5d0ae
c6fcc17c
+3
-11
1 changed file
expand all
collapse all
unified
split
2022
day11.livemd
+3
-11
2022/day11.livemd
···
206
206
207
207
def run(%__MODULE__{} = mb, rounds, calming) do
208
208
1..rounds
209
209
-
|> Enum.reduce(mb, fn r, mb ->
209
209
+
|> Enum.reduce(mb, fn _, mb ->
210
210
# IO.inspect(r, label: :round)
211
211
round(mb, calming)
212
212
end)
···
214
214
|> Enum.map(& &1.passes)
215
215
|> Enum.sort(:desc)
216
216
|> Enum.take(2)
217
217
-
|> Enum.reduce(&*/2)
217
217
+
|> Enum.product()
218
218
end
219
219
220
220
defp round(%__MODULE__{} = mb, calming) do
···
239
239
<!-- livebook:{"output":true} -->
240
240
241
241
```
242
242
-
warning: variable "r" is unused (if the variable is not meant to be used, prefix it with an underscore)
243
243
-
2022/day11.livemd#cell:wtmu5fny2ud5f5f6xet6khgysonm2y3n:17: MonkeyBusiness.run/3
244
244
-
245
245
-
```
246
246
-
247
247
-
<!-- livebook:{"output":true} -->
248
248
-
249
249
-
```
250
250
-
{:module, MonkeyBusiness, <<70, 79, 82, 49, 0, 0, 21, ...>>, {:lcm, 2}}
242
242
+
{:module, MonkeyBusiness, <<70, 79, 82, 49, 0, 0, 20, ...>>, {:lcm, 2}}
251
243
```
252
244
253
245
## Task 1