Enumerate for the printer positions (x,y) the radius from center. If the result is the desired radius, within a tolerance, print a mark. This draws a circle.
Recreated in coffeescript:
abs = (x) -> if x >= 0 then x else -x sqr = (x) -> x*x sqrt = (x) -> Math.sqrt(x) radius = (x,y) -> sqrt(sqr(x)+sqr(y)) black = (x,y) -> abs(radius(x,y)-15) < 3 mark = (x,y) -> if black(x,y) then "*" else "-" for y in [-20..20] by 2 console.log (mark(x,y) for x in [-20..20]).join ''
Produces this output:
***************** *********************** ************* ************* ******** ******** ******** ******** ****** ****** ****** ****** ****** ****** ***** ***** ****** ****** ****** ****** ****** ****** ******** ******** ******** ******** ************* ************* *********************** *****************