How to resolve the algorithm Yin and yang step by step in the Action! programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Yin and yang step by step in the Action! 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 Action! programming language
Source code in the action! programming language
INCLUDE "H6:REALMATH.ACT"
INCLUDE "D2:CIRCLE.ACT" ;from the Action! Tool Kit
PROC YinYang(INT x BYTE y BYTE r)
INT i,a,b,rr,r2,rr2,r5,rr5,y1,y2
REAL tmp1,tmp2
Circle(x,y,r,1)
rr=r*r
r2=r/2 rr2=rr/4
Color=1
FOR i=0 TO r
DO
a=rr-i*i
IntToReal(a,tmp1)
Sqrt(tmp1,tmp2)
a=RealToInt(tmp2)
b=rr2-(i-r2)*(i-r2)
IntToReal(b,tmp1)
Sqrt(tmp1,tmp2)
b=RealToInt(tmp2)
Plot(x+b,y-i) DrawTo(x+a,y-i)
Plot(x-b,y+i) DrawTo(x+a,y+i)
OD
r5=r/5
rr5=rr/25
y1=y-r2 y2=y+r2
FOR i=0 TO r5
DO
a=rr5-i*i
IntToReal(a,tmp1)
Sqrt(tmp1,tmp2)
a=RealToInt(tmp2)
Color=1
Plot(x-a,y1-i) DrawTo(x+a,y1-i)
Plot(x-a,y1+i) DrawTo(x+a,y1+i)
Color=0
Plot(x-a,y2-i) DrawTo(x+a,y2-i)
Plot(x-a,y2+i) DrawTo(x+a,y2+i)
OD
RETURN
PROC Main()
BYTE CH=$02FC,COLOR1=$02C5,COLOR2=$02C6
Graphics(8+16)
MathInit()
COLOR1=$00
COLOR2=$0F
YinYang(180,120,60)
YinYang(100,40,30)
DO UNTIL CH#$FF OD
CH=$FF
RETURN
You may also check:How to resolve the algorithm Write float arrays to a text file step by step in the Haskell programming language
You may also check:How to resolve the algorithm Monads/Maybe monad step by step in the OCaml programming language
You may also check:How to resolve the algorithm SHA-256 step by step in the DWScript programming language
You may also check:How to resolve the algorithm Find palindromic numbers in both binary and ternary bases step by step in the Scala programming language
You may also check:How to resolve the algorithm Bitwise operations step by step in the Z80 Assembly programming language