From 03ed9fc34c2d6738dcca9fe4bb5c4ccffd587ae1 Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Thu, 15 Dec 2022 14:51:23 +0000 Subject: o i dum --- day15/part2.rb | 35 ++++++++++++++++++----------------- 1 file 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 -- cgit v1.2.1