From: Andrea Fazzi Date: 2008-06-17T22:04:37+09:00 Subject: Re: [QUIZ] Circle Drawing (#166) Matthew Moss ha scritto: > ## Circle Drawing (#166) > > This week we're going to keep it simple... very simple. > > Given a radius, draw an ASCII circle. > > For example: > > ruby circle.rb 7 > > Should produce a circle of radius 7: > > ##### > ## ## > # # > # # > # # > # # > # # > # # > # # > # # > # # > # # > # # > ## ## > ##### > > > Note that most fonts do not have a square aspect ratio, which is why the > above output may look like an oval, despite my calculations for a circle. It > is acceptable if your code produces similar output. > > > However, _for extra credit_ you may support an additional argument that > specifies the aspect ratio (height divided by width). > > ruby circle.rb 7 1.4 > > This should draw a circle of radius 7 with aspect ratio of 1.4. If done > correctly, your output will actually look like a circle (assuming 1.4 is an > accurate measure of the actual aspect ratio). > > > > A bit of ruby art :-) http://pastie.org/216459 http://pastie.org/216462 I don't know if my benchmark is done properly.. I do it quickly and just for fun :-) Please give me feedback.. Benchmark details: num_of_runs = 100 radius = 7 ratio = 2.0 This benchmark has been executed on a MacBook 2,16Ghz with 2Gb of RAM running Linux Ubuntu 7.10. Andrea