Yin and yang: Difference between revisions

Content added Content deleted
(→‎{{header|Liberty BASIC}}: Add Logo section.)
(→‎{{header|UCB Logo}}: Add actual code.)
Line 296: Line 296:
=={{header|UCB Logo}}==
=={{header|UCB Logo}}==
[[File:YinYangLogo.gif||200px|thumb|right|UCB Logo Graphic Output]]
[[File:YinYangLogo.gif||200px|thumb|right|UCB Logo Graphic Output]]
<lang logo>
<lang logo>
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 r/2
localmake "r4 r/4
localmake "r8 r/8

; 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
pendown
fill

; put the turtle back where it started
penup
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


</lang>
</lang>