Chaos game: Difference between revisions
Content added Content deleted
(→{{header|BASIC256}}: add Locomotive Basic version) |
(Add Plain English) |
||
Line 1,818: | Line 1,818: | ||
main()</lang> |
main()</lang> |
||
=={{header|Plain English}}== |
|||
<lang plainenglish>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.</lang> |
|||
{{out}} |
|||
[https://commons.wikimedia.org/wiki/File:Chaos-game.png] |
|||
=={{header|Processing}}== |
=={{header|Processing}}== |