Musings of a Gotham City Geek

What is the sound of one blog clapping?

 

How would you pretty this up?

# Question posed by Jim Barnett on OKRb Mailing List...
 def fudgify_duplicates(points)
   fudged_points = []
   0.upto(points.length - 1) do |i|
     if i == 0
       fudged_points << points.first
     else
       if points[i - 1][0] == points[i][0]
         fudged_points << [points[i][0] + 1, points[i][1]]
       else
         fudged_points << points[i]
       end
     end
   end
   fudged_points
 end

Blog comments powered by Disqus