We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d360a5a commit bac3cceCopy full SHA for bac3cce
1 file changed
lib/2017/day_18.ex
@@ -52,15 +52,15 @@ defmodule AdventOfCode.Y2017.Day18 do
52
s0 = %{s0 | queue: s0.queue ++ out1}
53
new_sent_count = sent_count + length(out1)
54
55
- if (out0 == [] and out1 == [] and is_deadlock(s0, s1, stat0, stat1)) or
+ if (out0 == [] and out1 == [] and deadlock?(s0, s1, stat0, stat1)) or
56
(stat0 == :halted and stat1 == :halted) do
57
new_sent_count
58
else
59
simulate(s0, s1, new_sent_count)
60
end
61
62
63
- defp is_deadlock(s0, s1, stat0, stat1) do
+ defp deadlock?(s0, s1, stat0, stat1) do
64
(stat0 == :blocked and s0.queue == [] and (stat1 == :blocked and s1.queue == [])) or
65
(stat0 == :halted and stat1 == :blocked and s1.queue == []) or
66
(stat1 == :halted and stat0 == :blocked and s0.queue == [])
0 commit comments