aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Lasseter <user@4574.co.uk>2022-12-15 14:51:23 +0000
committerNat Lasseter <user@4574.co.uk>2022-12-15 14:51:23 +0000
commit03ed9fc34c2d6738dcca9fe4bb5c4ccffd587ae1 (patch)
tree30ecc26a2425f49ea29e9bc8fd5c2be85bcdbad6
parent9f1b752bbd96c53f974e0cca4af6c1412102e62d (diff)
o i dum
-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