[2017][ruby][12.x] speedrun
diff --git a/2017/ruby/day_12.rb b/2017/ruby/day_12.rb
new file mode 100644
index 0000000..0470e02
--- /dev/null
+++ b/2017/ruby/day_12.rb
@@ -0,0 +1,19 @@
+require "set"
+h = Hash[ARGF.read.strip.scan(/(\d+) <-> ([\d, ]+)/).map {|a,b| [a.to_i, b.scan(/\d+/).map(&:to_i)]}]
+count = 0
+until h.empty?
+ key = h.keys.first
+ foo = Set.new
+ foo << key
+ bar = [key]
+ until bar.empty?
+ baz = bar.shift
+ bar = bar.concat(h[baz] - foo.to_a)
+ foo = foo.merge(h[baz])
+ end
+ count += 1
+ foo.each do |k|
+ h.delete(k)
+ end
+end
+p count