From def5de316d1561b59173c83e78c0f98adb2448d7 Mon Sep 17 00:00:00 2001 From: s00ner Date: Tue, 12 Jul 2022 10:56:07 -0400 Subject: [PATCH] Formatting --- day01/solution.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/day01/solution.rb b/day01/solution.rb index 9fd9c88..483991e 100644 --- a/day01/solution.rb +++ b/day01/solution.rb @@ -3,15 +3,15 @@ # Part 1, To what floor do the instructions take Santa? directions = File.read('./input') p1answer = directions.each_char.map { |char| char == '(' ? 1 : -1 }.sum -puts "Part 1 Answer: " + p1answer.to_s +puts 'Part 1 Answer: ' + p1answer.to_s # Part 2, What is the position of the character that causes Santa to first enter the basement? directions = directions.each_char.map { |char| char == '(' ? 1 : -1 } position = 0 catch :basement do - directions.each.with_index do | x, i | - position = i + 1 - throw :basement if directions[0..i].sum == -1 - end + directions.each.with_index do |_x, i| + position = i + 1 + throw :basement if directions[0..i].sum == -1 + end end -puts "Part 2 Answer: " + position.to_s \ No newline at end of file +puts 'Part 2 Answer: ' + position.to_s