1
0
Fork 0

Print bad data

This commit is contained in:
Andrew Tomaka 2024-12-24 11:18:57 -05:00
parent 3dfad26d0d
commit 9005e65ebc
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -36,6 +36,11 @@ until gates.empty?
gates.delete(gate)
end
p wires.select { _1.match?(/^x/) }.sort_by(&:first).map { _1.last.to_s }.reverse.join.to_i(2)
p wires.select { _1.match?(/^y/) }.sort_by(&:first).map { _1.last.to_s }.reverse.join.to_i(2)
x = wires.select { _1.match?(/^x/) }.sort_by(&:first).map { _1.last.to_s }.reverse.join.to_i(2)
y = wires.select { _1.match?(/^y/) }.sort_by(&:first).map { _1.last.to_s }.reverse.join.to_i(2)
p (x + y)
p wires.select { _1.match?(/^z/) }.sort_by(&:first).map { _1.last.to_s }.reverse.join.to_i(2)
__END__