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.


to taijitu :r 
  ; Draw a classic Taoist taijitu of the given radius centered on the current
  ; turtle position. The "eyes" are placed along the turtle's heading, the
  ; filled one in front, the open one behind.
 
  ; don't bother doing anything if the pen is not down
  if not pendown? [stop]
 
  ; useful derivative values
  localmake "r2 (ashift :r  -1)
  localmake "r4 (ashift :r2 -1)
  localmake "r8 (ashift :r4 -1)
 
  ; remember where we started
  localmake "start  pos
 
  ; draw outer circle
  pendown
  arc 360 :r
 
  ; draw upper half of S
  penup
  forward :r2
  pendown
  arc 180 :r2
 
  ; and filled inner eye
  arc 360 :r8
  fill
 
  ; draw lower half of S
  penup
  back :r
  pendown
  arc -180 :r2
 
  ; other inner eye
  arc  360 :r8
 
  ; fill this half of the symbol 
  penup
  forward :r4
  fill
 
  ; put the turtle back where it started
  setpos :start
  pendown
end
 
; demo code to produce image at right
clearscreen
pendown
hideturtle
taijitu 100
penup
forward 150
left 90
forward 150
pendown
taijitu 75