How to resolve the algorithm Yin and yang step by step in the Rascal programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Yin and yang step by step in the Rascal 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 Rascal programming language

Source code in the rascal programming language

import util::Math;
import vis::Render;
import vis::Figure;

public void yinyang(){
	template = ellipse(fillColor("white"));
	
	smallWhite = ellipse(fillColor("white"), shrink(0.1), valign(0.75));
	smallBlack = ellipse(fillColor("black"), shrink(0.1), valign(0.25));
	 
	dots= [ellipse(fillColor("white"), shrink(0.000001), align(0.5 + sin(0.0031415*n)/4, 0.25 + cos(0.0031415*n)/-4)) | n <- [1 .. 1000]];
	dots2 = [ellipse(fillColor("black"), shrink(0.000001), align(0.5 + sin(0.0031415*n)/-4, 0.75 + cos(0.0031415*n)/-4)) | n <- [1 .. 1000]];
	dots3= [ellipse(fillColor("black"), shrink(0.000001), align(0.5 + sin(0.0031415*n)/2, 0.5-cos(0.0031415*n)/-2)) | n <- [1 .. 1000]];
	 
	black= overlay([*dots, *dots2, *dots3], shapeConnected(true), shapeClosed(true), shapeCurved(true), fillColor("black"));
	 
	render(hcat([vcat([overlay([template, black, smallWhite, smallBlack], aspectRatio (1.0)), space(), space()]), 
	                   overlay([template, black, smallWhite, smallBlack], aspectRatio (1.0))]));
}

  

You may also check:How to resolve the algorithm Host introspection step by step in the Seed7 programming language
You may also check:How to resolve the algorithm Factorial primes step by step in the Delphi programming language
You may also check:How to resolve the algorithm Compound data type step by step in the D programming language
You may also check:How to resolve the algorithm N'th step by step in the Wren programming language
You may also check:How to resolve the algorithm Checkpoint synchronization step by step in the Julia programming language