File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff 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 { |_wire , signal | signal . to_s }
5050 . join
5151 . to_i ( 2 )
5252 end
You can’t perform that action at this time.
0 commit comments