How to resolve the algorithm Chaos game step by step in the Plain English programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Chaos game step by step in the Plain English programming language
Table of Contents
Problem Statement
The Chaos Game is a method of generating the attractor of an iterated function system (IFS). One of the best-known and simplest examples creates a fractal, using a polygon and an initial point selected at random.
Play the Chaos Game using the corners of an equilateral triangle as the reference points. Add a starting point at random (preferably inside the triangle). Then add the next point halfway between the starting point and one of the reference points. This reference point is chosen at random. After a sufficient number of iterations, the image of a Sierpinski Triangle should emerge.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Chaos game step by step in the Plain English programming language
Source code in the plain programming language
To run:
Start up.
Initialize our reference points.
Clear the screen to the lightest gray color.
Play the chaos game.
Refresh the screen.
Wait for the escape key.
Shut down.
To play the chaos game:
Pick a spot within 2 inches of the screen's center.
Loop.
Draw the spot.
If a counter is past 20000, exit.
Pick a reference spot.
Find a middle spot of the spot and the reference spot.
Put the middle spot into the spot.
Repeat.
To find a middle spot of a spot and another spot:
Put the spot's x coord plus the other spot's x coord divided by 2 into the middle spot's x coord.
Put the spot's y coord plus the other spot's y coord divided by 2 into the middle spot's y coord.
The top spot is a spot.
The left spot is a spot.
The right spot is a spot.
To initialize our reference points:
Move up 2-1/2 inches.
Put the context's spot into the top spot.
Turn right. Turn 1/6 of the way around.
Move 5 inches.
Put the context's spot into the right spot.
Turn 1/3 of the way around.
Move 5 inches.
Put the context's spot into the left spot.
To pick a reference spot:
Pick a number between 1 and 3.
If the number is 1, put the top spot into the reference spot.
If the number is 2, put the right spot into the reference spot.
If the number is 3, put the left spot into the reference spot.
You may also check:How to resolve the algorithm Loops/Downward for step by step in the Plain English programming language
You may also check:How to resolve the algorithm Temperature conversion step by step in the Plain English programming language
You may also check:How to resolve the algorithm Reverse a string step by step in the Plain English programming language
You may also check:How to resolve the algorithm Determine if a string is numeric step by step in the Plain English programming language
You may also check:How to resolve the algorithm Primality by Wilson's theorem step by step in the Plain English programming language