From 28f8fa5d249f7579b76bf66a8593a91fc02edb03 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Sun, 9 Dec 2018 21:20:50 -0800 Subject: [PATCH] [2018][ruby][10.2] --- 2018/ruby/day_10.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/2018/ruby/day_10.rb b/2018/ruby/day_10.rb index b3cb247..42a2c71 100644 --- a/2018/ruby/day_10.rb +++ b/2018/ruby/day_10.rb @@ -351,7 +351,7 @@ def print_points(points) max_y = points.map(&:position).map(&:last).max # return if max_x - min_x > 500 - return if max_y - min_y > 100 + return if max_y - min_y > 10 h = points.each.with_object(Hash.new(?.)) {|point, h| h[point.position] = ?# @@ -367,10 +367,13 @@ def print_points(points) gets end +i = 0 loop do print_points(points) + puts i points.each {|point| point.position[0] += point.velocity[0] point.position[1] += point.velocity[1] } + i += 1 end