How to resolve the algorithm Yin and yang step by step in the Logo programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Yin and yang step by step in the Logo programming language
Table of Contents
Problem Statement
One well-known symbol of the philosophy of duality known as yin and yang is the taijitu.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Yin and yang step by step in the Logo programming language
Source code in the logo programming language
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
You may also check:How to resolve the algorithm Null object step by step in the Lasso programming language
You may also check:How to resolve the algorithm Program name step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Image convolution step by step in the Octave programming language
You may also check:How to resolve the algorithm Remove duplicate elements step by step in the Rust programming language
You may also check:How to resolve the algorithm Calculating the value of e step by step in the Peri programming language