From: Alex Shulgin Date: 2008-02-16T22:14:55+09:00 Subject: Re: The Smallest Circle (#157) On Feb 15, 3:19 pm, Matthew D Moss wrote: > > The Smallest Circle > by Matthew Moss > > Your task this week sounds simple enough, but may be more difficult > than it first appears. Given a set of points on a plane, your goal is > to find the smallest circle that encloses those points. > > You are to provide a function, *encircle*, that takes an array of > points and returns the smallest circle surrounding those points. > Start with the following base code and extend as needed to solve the > problem: > > class Point < Struct.new(:x, :y) > def self.random > Point.new(rand, rand) > end May I propose a bit refined random method? class Point < Struct.new(:x, :y) def self.random Point.new(0.5 - rand, 0.5 - rand) end This should give us negative coordinates as well. :-) -- Cheers and welcome new quizmasters! Alex