mirror of
https://github.com/onyx-and-iris/aoc2025.git
synced 2025-12-07 22:57:50 +00:00
remove loop
This commit is contained in:
parent
f073b70176
commit
91c0cfa768
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user