this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[day4] optimize condition

estym 2c49e199 70578ca2

+3 -6
+3 -6
src/days/day4.gleam
··· 54 54 55 55 fn count_neighbours(cell: Paper, grid: Grid) { 56 56 grid.cells 57 - |> list.filter(fn(paper) { !{ cell.x == paper.x && cell.y == paper.y } }) 58 57 |> list.filter(fn(paper) { 59 - case cell.x + 1 == paper.x || cell.x - 1 == paper.x || cell.x == paper.x { 60 - True -> 61 - cell.y + 1 == paper.y || cell.y - 1 == paper.y || cell.y == paper.y 62 - False -> False 63 - } 58 + !{ cell.x == paper.x && cell.y == paper.y } 59 + && { cell.x + 1 == paper.x || cell.x - 1 == paper.x || cell.x == paper.x } 60 + && { cell.y + 1 == paper.y || cell.y - 1 == paper.y || cell.y == paper.y } 64 61 }) 65 62 |> list.length 66 63 }