From: Jon Garvin Date: 2008-06-17T00:54:54+09:00 Subject: Re: [QUIZ] Circle Drawing (#166) Here's mine before I delved into trying to add the aspect ratio feature. class Circle def initialize(radius) @radius = radius.to_i end def draw (0..@radius*2).each do |x| (0..@radius*2).each do |y| print distance_from_center(x,y).round == @radius ? '#' : '.' end puts end end def distance_from_center(x,y) a = calc_side(x) b = calc_side(y) return Math.sqrt(a**2 + b**2) end def calc_side(z) z < @radius ? (@radius - z) : (z - @radius) end end Circle.new(ARGV.shift).draw -- http://www.5valleys.com/ http://www.workingwithrails.com/person/8078