Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Just for fun
Hi all,
Its Saturday afternoon, its raining and the rugby doesn't start for a while, so....
create or replace procedure circle is
pi constant number(5,3) := 3.142;
screenWidth int := 40;
radius int := screenWidth / 2;
spot char(1) := '*';
p1 number;
p2 number;
row int;
begin
for row in 0 .. screenWidth
loop
p1 := round(radius - (radius * sin(acos((radius-row)/radius)))) + 1; -- add 1 as lpad(char,0) doesn't print a char p2 := (radius - p1) * 2; dbms_output.put_line(lpad(spot,p1)--||lpad(spot,p2) ||case when p2 = 1 then null else lpad(spot,p2) end ||'('||row||','||p1||'),('||row||','|| to_char(p1 + p2) ||')' );
when others then raise_application_error(-20000, 'Ohps: something went pair shaped at '|| '('||row||','||p1||'),('||row||','|| to_char(p1 + p2) ||')' );
Why's my circle look like a rugby ball.. is it a sign from the gods that the game's just about to start? Or is my formual wrong or is it just the dodgy screen printing technique?
Have a good weekend
Cheers
Tony
PS Come on Wales and that's coming from an English man!
-- http://www.freelists.org/webpage/oracle-lReceived on Sat Nov 05 2005 - 09:51:50 CST
![]() |
![]() |