Sierpinski carpet: Difference between revisions
Content added Content deleted
Line 4,244: | Line 4,244: | ||
{{out}} |
{{out}} |
||
{{incomplete|powershell|Upload of files currently blocked. Needs output screenshot once file uploading is again allowed.}} |
{{incomplete|powershell|Upload of files currently blocked. Needs output screenshot once file uploading is again allowed.}} |
||
=={{header|Processing}}== |
|||
<lang java>float delta; |
|||
void setup() { |
|||
size(729, 729); |
|||
fill(0); |
|||
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}}== |
=={{header|Prolog}}== |