[2018][ruby][10.2]

sorbet
Alpha Chen 6 years ago
parent ac044c28d0
commit 28f8fa5d24

@ -351,7 +351,7 @@ def print_points(points)
max_y = points.map(&:position).map(&:last).max max_y = points.map(&:position).map(&:last).max
# return if max_x - min_x > 500 # 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 = points.each.with_object(Hash.new(?.)) {|point, h|
h[point.position] = ?# h[point.position] = ?#
@ -367,10 +367,13 @@ def print_points(points)
gets gets
end end
i = 0
loop do loop do
print_points(points) print_points(points)
puts i
points.each {|point| points.each {|point|
point.position[0] += point.velocity[0] point.position[0] += point.velocity[0]
point.position[1] += point.velocity[1] point.position[1] += point.velocity[1]
} }
i += 1
end end

Loading…
Cancel
Save