what's wrong with my drawCircle function, it looks like i'm drawing vertical line.
my code:
function void drawCircle(int cx, int cy, int r) {
var int dx, dy;
var int r_squared;
if ((cx>511)|(cy>255)|(r>181)) {
do Sys.error(12);
}
let dy = -r;
let r_squared = r*r;
while( ~(dy > r) ) {
let dx = Math.sqrt(r_squared-(dy*dy));
do Screen.drawHorizontal( cx-dx, cx+dx, cy+dy );
let dy = dy + 1;
}
return;
}