From 21d032dbff1dea52b8be5651bc52851b21d4dc31 Mon Sep 17 00:00:00 2001 From: Benjamin Wuethrich Date: Wed, 11 Dec 2024 09:50:02 -0500 Subject: [PATCH] Add 2024, day 11, first part --- 2024/day11/day11a | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 2024/day11/day11a diff --git a/2024/day11/day11a b/2024/day11/day11a new file mode 100755 index 00000000..ac778592 --- /dev/null +++ b/2024/day11/day11a @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +stones = File.read(ARGV[0]).split + +25.times do + stones_new = stones.flat_map do |n| + if n == "0" + "1" + elsif n.length.even? + [n[...n.length / 2], n[n.length / 2..].to_i.to_s] + else + (n.to_i * 2024).to_s + end + end + + stones = stones_new +end + +puts stones.length