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.


taijitu = cluster is make
    rep = null
 
    circle = proc (x,y,c,r: int) returns (bool)
        return (r**2 >= (x/2)**2 + (y-c)**2)
    end circle
 
    pixel = proc (x,y,r: int) returns (char)
        if     circle(x,y,-r/2,r/6) then return('#')
        elseif circle(x,y, r/2,r/6) then return('.')
        elseif circle(x,y,-r/2,r/2) then return('.')
        elseif circle(x,y, r/2,r/2) then return('#')
        elseif circle(x,y,   0,  r) then
            if x<0 then return('.') else return('#') end
        end
        return(' ')
    end pixel
 
    make = proc (r: int) returns (string)
        chars: array[char] := array[char]$predict(1, r*r*2+r)
        for y: int in int$from_to(-r, r) do
            for x: int in int$from_to(-2*r, 2*r) do
                array[char]$addh(chars, pixel(x,y,r))
            end
            array[char]$addh(chars, '\n')
        end
        return (string$ac2s(chars))
    end make
end taijitu
 
start_up = proc ()
    po: stream := stream$primary_output()
    stream$putl(po, taijitu$make(4))
    stream$putl(po, taijitu$make(8))
end start_up