Sierpinski pentagon: Difference between revisions

Line 1,065:
 
=={{header|Processing}}==
<lang java>float delta;Error
Needs editing</lang>
 
void setup() {
size(729, 729);
fill(0, 0, 200);
background(255);
noStroke();
rect(width/3, height/3, width/3, width/3);
rectangles(width/3, height/3, width/3);
}
 
 
void rectangles(int x, int y, int s) {
if (s < 1) return;
int xc = x-s;
int yc = y-s;
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 3; col++) {
if (!(row == 1 && col == 1)) {
int xx = xc+row*s;
int yy = yc+col*s;
delta = s/3;
rect(xx+delta, yy+delta, delta, delta);
rectangles(xx+s/3, yy+s/3, s/3);
}
}
}
}</lang>'''The sketch can be run online''' :<BR> [https://www.openprocessing.org/sketch/953411 here.]
 
 
 
 
 
 
 
 
=={{header|Prolog}}==
47

edits