------ art_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 = rdx * (ratio.ceil) * 2
mtrx = Array.new(size).map!{ Array.new(size) }
(0..size-1).each do |file|
(0..size-1).each do |col|
mtrx[file][col] = " "
end
end
mtrx
end
def load_mtrx(mtrx,rdx,ratio=1)
(1..360).each do |grado|
x = ((Math.sin grado) * (rdx * ratio)) + (rdx * ratio)
y = ((Math.cos grado) * rdx) + rdx
mtrx[x.to_i][y.to_i] = "#"
end
nil
end
def main
rdx = ARGV[0].to_i
ratio = ARGV[1].to_f
mtrx = new_mtrx(rdx,ratio)
load_mtrx(mtrx,rdx,ratio)
draw(mtrx)
end
main
# end file
--
uien nunca ha cometido un error nunca ha probado algo nuevo.¥µ
------ art_3819_24161746.1213575530479--