One well-known symbol of the philosophy of duality known as yin and yang is the taijitu.



Task

   Create a function that, given a parameter representing size, generates such a symbol scaled to the requested size.
   Generate and display the symbol for two different (small) sizes.


include c:\cxpl\codes;          \intrinsic 'code' declarations
 
def Black=0, Red=4, White=$F;
 
proc Circle(X0, Y0, R, CL, CR); \Show a filled circle
int X0, Y0, R, CL, CR;          \left and right half colors
int X, Y;
[for Y:= -R to R do
    for X:= -R to R do
        if X*X + Y*Y <= R*R then
            Point(X+X0, Y+Y0, if X<0 then CL else CR);
]; \Circle
 
proc YinYang(X0, Y0, R);
int  X0, Y0, R;
[Circle(X0, Y0,     R,   White, Black);
 Circle(X0, Y0-R/2, R/2, White, White);
 Circle(X0, Y0-R/2, R/6, Black, Black);
 Circle(X0, Y0+R/2, R/2, Black, Black);
 Circle(X0, Y0+R/2, R/6, White, White);
]; \YinYang
 
[SetVid($101);                  \640x480 graphics
Circle(320, 240, 400, Red, Red);\fill screen with background color
YinYang(80, 80, 70);
YinYang(240, 240, 150);
if ChIn(1) then [];             \wait for keystroke
SetVid(3);                      \restore normal text mode
]