Day10: tuples are iterable.
This commit is contained in:
6
day10.cr
6
day10.cr
@@ -12,10 +12,6 @@ struct Tuple(*T)
|
||||
def -(other)
|
||||
{self[0]-other[0], self[1] - other[1]}
|
||||
end
|
||||
|
||||
def dist
|
||||
self[0] + self[1]
|
||||
end
|
||||
end
|
||||
|
||||
input = input(2019, 10)
|
||||
@@ -53,7 +49,7 @@ end
|
||||
angle_groups.delete({0,0})
|
||||
angle_groups.each do |k, v|
|
||||
v.sort! do |a|
|
||||
(a - p2s).dist
|
||||
(a - p2s).sum
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user