From f052d8ef786224f7829b1d7ff2735b1695485dbc Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Mon, 7 Dec 2020 17:06:30 -0800 Subject: [PATCH] Day10: tuples are iterable. --- day10.cr | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/day10.cr b/day10.cr index 13641f2..cb11d7c 100644 --- a/day10.cr +++ b/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