Skip to content

Commit 45a0583

Browse files
committed
day 14, part 1 (refactor)
More names for things, I guess.
1 parent abcb023 commit 45a0583

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

2024/ruby/day24.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ def part1
3535
while to_be_determined.keys.any? {|wire| wire.start_with?('z') } do
3636
puts to_be_determined.keys.inspect if ENV['DEBUG']
3737
to_be_determined
38-
.select {|wire, gate| gate[:inputs].all? { known_wires.key?(_1) } }
39-
.each do |wire, gate|
40-
known_wires[wire] = gate[:proc].call
41-
to_be_determined.delete(wire)
38+
.select {|_wire, gate| gate[:inputs].all? { known_wires.key?(_1) } }
39+
.each do |computable_wire, gate|
40+
known_wires[computable_wire] = gate[:proc].call
41+
to_be_determined.delete(computable_wire)
4242
end
4343
end
4444

4545
known_wires
46-
.select {|wire, signal| wire.start_with?('z') }
47-
.sort_by {|wire, signal| wire }
46+
.select {|wire, _signal| wire.start_with?('z') }
47+
.sort_by {|z_wire, _signal| z_wire }
4848
.reverse
49-
.map {|wire, signal| signal.to_s }
49+
.map {|_z_wire_significantly_ordered, signal| signal.to_s }
5050
.join
5151
.to_i(2)
5252
end

0 commit comments

Comments
 (0)