Skip to content

Commit 627f737

Browse files
committed
Refactor distinct_combs function in Day19 module
1 parent f9a4508 commit 627f737

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

19/sol.exs

+2-14
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,9 @@ defmodule Day19 do
8787

8888
def partB(file_path) do
8989
{workflows, _} = read_input(file_path)
90+
dr = %{h: 4000, l: 1}
9091

91-
distinct_combs(
92-
workflows,
93-
[
94-
%{
95-
:loc => "in",
96-
"x" => %{h: 4000, l: 1},
97-
"m" => %{h: 4000, l: 1},
98-
"a" => %{h: 4000, l: 1},
99-
"s" => %{h: 4000, l: 1}
100-
}
101-
],
102-
0
103-
)
92+
distinct_combs(workflows, [%{:loc => "in", "x" => dr, "m" => dr, "a" => dr, "s" => dr}], 0)
10493
end
10594

10695
def distinct_combs(_, [], acc), do: acc
@@ -109,7 +98,6 @@ defmodule Day19 do
10998
workflows,
11099
[
111100
%{
112-
:loc => loc,
113101
"x" => %{h: xh, l: xl},
114102
"m" => %{h: mh, l: ml},
115103
"a" => %{h: ah, l: al},

0 commit comments

Comments
 (0)