aboutsummaryrefslogtreecommitdiff
path: root/day15/part2.rb
diff options
context:
space:
mode:
Diffstat (limited to 'day15/part2.rb')
-rw-r--r--day15/part2.rb35
1 files changed, 18 insertions, 17 deletions
diff --git a/day15/part2.rb b/day15/part2.rb
index cb3219d..e7ba5d3 100644
--- a/day15/part2.rb
+++ b/day15/part2.rb
@@ -17,26 +17,27 @@ class Sensor
def edge
edges = []
- at = [@x, @y - (@range + 1)]
- until at[1] == @y
- edges << at
- at[0] += 1
- at[1] += 1
+ atx = @x
+ aty = @y - (@range + 1)
+ until aty == @y
+ edges << [atx, aty]
+ atx += 1
+ aty += 1
end
- until at[0] == @x
- edges << at
- at[0] -= 1
- at[1] += 1
+ until atx == @x
+ edges << [atx, aty]
+ atx -= 1
+ aty += 1
end
- until at[1] == @y
- edges << at
- at[0] -= 1
- at[1] -= 1
+ until aty == @y
+ edges << [atx, aty]
+ atx -= 1
+ aty -= 1
end
- until at[0] == @x
- edges << at
- at[0] += 1
- at[1] -= 1
+ until atx == @x
+ edges << [atx, aty]
+ atx += 1
+ aty -= 1
end
edges
end