[2025][ruby][1.x]
change vkwlssyxtvxnulyzurpzvnrvsmmvsxum
commit 9226f9eb9336200c717007751d490a4767e01cd5
author Alpha Chen <alpha@kejadlen.dev>
date
parent spoqqvyq
diff --git a/2025/ruby/day_01.rb b/2025/ruby/day_01.rb
new file mode 100644
index 0000000..20ea052
--- /dev/null
+++ b/2025/ruby/day_01.rb
@@ -0,0 +1,22 @@
+input = DATA.read.scan(/([LR])(\d+)/)
+  .map { [_1, _2.to_i] }
+
+points = [50]
+
+input.each do |dir, distance|
+  sign = case dir
+         when ?L then -1
+         when ?R then 1
+         else fail
+         end
+  # part one
+  # points << (points.last + distance * sign) % 100
+
+  distance.times do
+    points << (points.last + sign) % 100
+  end
+end
+
+pp points.count(&:zero?)
+
+__END__