Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Chaos-game/Processing/chaos-game.processing
Normal file
29
Task/Chaos-game/Processing/chaos-game.processing
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
size(300, 260);
|
||||
|
||||
background(#ffffff); // white
|
||||
|
||||
int x = floor(random(width));
|
||||
int y = floor(random(height));
|
||||
|
||||
int colour = #ffffff;
|
||||
|
||||
for (int i=0; i<30000; i++) {
|
||||
int v = floor(random(3));
|
||||
switch (v) {
|
||||
case 0:
|
||||
x = x / 2;
|
||||
y = y / 2;
|
||||
colour = #00ff00; // green
|
||||
break;
|
||||
case 1:
|
||||
x = width/2 + (width/2 - x)/2;
|
||||
y = height - (height - y)/2;
|
||||
colour = #ff0000; // red
|
||||
break;
|
||||
case 2:
|
||||
x = width - (width - x)/2;
|
||||
y = y / 2;
|
||||
colour = #0000ff; // blue
|
||||
}
|
||||
set(x, height-y, colour);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue