Advent of Code 2021 day 9
12/09/2021, 5:00 AMMarcin Wisniowski
12/09/2021, 5:34 AMDavid Whittaker
12/09/2021, 5:36 AMDavid Whittaker
12/09/2021, 5:39 AMMarcin Wisniowski
12/09/2021, 5:41 AMDavid Whittaker
12/09/2021, 5:43 AMgetAdjacentSides()
ready to goDavid Whittaker
12/09/2021, 5:45 AMreduce
to get the product of a listMarcin Wisniowski
12/09/2021, 5:47 AMDavid Whittaker
12/09/2021, 5:49 AMSimon Nyström
12/09/2021, 6:18 AMSimon Nyström
12/09/2021, 6:18 AMSimon Nyström
12/09/2021, 6:18 AMDavid Whittaker
12/09/2021, 6:22 AMDavid Whittaker
12/09/2021, 6:22 AMtakeLast()
-- I'll need to remember that too!Simon Nyström
12/09/2021, 6:29 AMDan Fingal-Surma
12/09/2021, 7:47 AMDan Fingal-Surma
12/09/2021, 7:56 AMreduce(Int::times)
Tobias Suchalla
12/09/2021, 8:43 AM.let { (a, b, c) -> a * b * c }
.
https://github.com/Sydenth/aoc-21/blob/main/src/year2021/day09/Day09.ktTobias Suchalla
12/09/2021, 8:46 AMDavid Whittaker
12/09/2021, 9:01 AMTobias Suchalla
12/09/2021, 9:04 AMPaul Woitaschek
12/09/2021, 9:10 AMDan Fingal-Surma
12/09/2021, 9:12 AMif (surrounding.value == from.value + 1)
Dan Fingal-Surma
12/09/2021, 9:12 AM890399
and 9436569
appear in the main map, for examplePaul Woitaschek
12/09/2021, 9:15 AMDan Fingal-Surma
12/09/2021, 9:15 AMPaul Woitaschek
12/09/2021, 9:16 AMnkiesel
12/09/2021, 9:24 AMnkiesel
12/09/2021, 9:33 AMreturn neighbors(x, y).none { (cx, cy) -> this[cy][cx] <= p }
Michael de Kaste
12/09/2021, 10:30 AMephemient
12/09/2021, 11:09 AMMichael Böiers
12/09/2021, 12:00 PMMichael de Kaste
12/09/2021, 1:02 PMmutableSetOf(this).apply{
with it, small speedup from ~0.0104s -> ~0.0089s. đ
(Edit: even better now that I do neighbor checking by lazy)Pitel
12/09/2021, 1:05 PMMichael Böiers
12/09/2021, 4:38 PMMichael Böiers
12/09/2021, 4:44 PMphldavies
12/09/2021, 5:31 PMDan Fingal-Surma
12/09/2021, 5:42 PMphldavies
12/09/2021, 5:44 PMDavid Whittaker
12/09/2021, 6:21 PMMichael Böiers
12/09/2021, 6:50 PMtodd.ginsberg
12/09/2021, 6:53 PMMichael Böiers
12/09/2021, 7:13 PMMichael Böiers
12/09/2021, 7:15 PMKiet
12/10/2021, 4:45 AM