[2017][ruby][10.x]
change ywontuqmyrymuptuyzttuyuwtszumpuz
commit 914735cf67186ab3bb8c676d6335be7122df9e24
author Alpha Chen <alpha.chen@gmail.com>
date
parent nxzwypwr
diff --git a/2017/input/day_03.txt b/2017/input/day_03.txt
deleted file mode 100644
index 8c418b6..0000000
--- a/2017/input/day_03.txt
+++ /dev/null
@@ -1 +0,0 @@
-361527
\ No newline at end of file
diff --git a/2017/ruby/day_10.rb b/2017/ruby/day_10.rb
new file mode 100644
index 0000000..20f0c69
--- /dev/null
+++ b/2017/ruby/day_10.rb
@@ -0,0 +1,33 @@
+list = (0..255).to_a
+current = 0
+# lengths = ARGF.read.strip.split(?,).map(&:to_i)
+input = ARGF.read.strip
+p input
+lengths = input.split(//).map(&:ord)
+p lengths
+lengths.concat([17, 31, 73, 47, 23])
+skip = 0
+
+# list = (0..4).to_a
+# lengths = [3,4,1,5]
+
+64.times do
+  lengths.each do |length|
+    list[0, length] = list[0, length].reverse
+    list = list.rotate(length + skip)
+    current += length + skip
+    current %= list.size
+    skip += 1
+
+    # p list.rotate(list.size - current)
+  end
+end
+
+list = list.rotate(list.size - current)
+p list
+dense = list.each_slice(16).map {|slice| slice.inject(&:^) }
+p dense
+p hex = dense.map {|n| n.to_s(16).rjust(2, ?0) }.join
+
+# list = list.rotate(list.size - current)
+# p list[0] * list[1]