Skip to content

Commit

Permalink
Parallelize 2024-06
Browse files Browse the repository at this point in the history
  • Loading branch information
Janiczek committed Dec 6, 2024
1 parent 198e163 commit 2bc3377
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/aoc_2024/day_6.gleam
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import extra
import gleam/list
import gleam/set.{type Set}
import grid.{type Dir, type Grid, type XY}

Expand Down Expand Up @@ -50,15 +52,16 @@ pub fn pt_2(input: Input) {
grid.Top,
)
orig_path
|> set.filter(fn(step: XY) {
|> set.to_list
|> extra.pmap(fn(step: XY) {
pt_2_has_loop(
grid.insert(input.grid, step, Nil),
set.new(),
input.guard_xy,
grid.Top,
)
})
|> set.size
|> list.count(fn(bool) { bool })
}

fn pt_2_has_loop(
Expand Down

0 comments on commit 2bc3377

Please sign in to comment.