From: "Juan Matías" Date: 2008-06-16T09:17:59+09:00 Subject: Re: [QUIZ] Circle Drawing (#166) ------=_Part_3819_24161746.1213575530479 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline # circle.rb def draw(mtrx) mtrx.each do |file| puts file.to_s end nil end def new_mtrx(rdx,ratio) size =3D rdx * (ratio.ceil) * 2 mtrx =3D Array.new(size).map!{ Array.new(size) } (0..size-1).each do |file| (0..size-1).each do |col| mtrx[file][col] =3D " " end end mtrx end def load_mtrx(mtrx,rdx,ratio=3D1) (1..360).each do |grado| x =3D ((Math.sin grado) * (rdx * ratio)) + (rdx * ratio) y =3D ((Math.cos grado) * rdx) + rdx mtrx[x.to_i][y.to_i] =3D "#" end nil end def main rdx =3D ARGV[0].to_i ratio =3D ARGV[1].to_f mtrx =3D new_mtrx(rdx,ratio) load_mtrx(mtrx,rdx,ratio) draw(mtrx) end main # end file --=20 =ABQuien nunca ha cometido un error nunca ha probado algo nuevo.=BB ------=_Part_3819_24161746.1213575530479--