mirror of
https://github.com/onyx-and-iris/aoc2025.git
synced 2026-04-08 19:13:37 +00:00
remove loop
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Main
|
||||
def run
|
||||
@@ -8,12 +9,12 @@ class Main
|
||||
$stdin.each_line do |line|
|
||||
direction, magnitude = line[0], line[1..].to_i
|
||||
|
||||
loop do
|
||||
while magnitude > 0
|
||||
case direction
|
||||
when "R"
|
||||
current = (current + 1) % 100
|
||||
when "L"
|
||||
current = (current - 1) % 100
|
||||
current = (current - 1 + 100) % 100
|
||||
end
|
||||
|
||||
if current == 0
|
||||
@@ -21,7 +22,6 @@ class Main
|
||||
end
|
||||
|
||||
magnitude -= 1
|
||||
break if magnitude == 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user