by Sandro Maffiodo
smaffer@gmail.com
www.assezeta.com/sandromaffiodo
This is a fractals generator. It generates a fractal like the Sierpinski Carpet but little different.
$(CC) prog.c -o prog
echo 27 | ./prog > image.ppm
To view the generate image you can use GIMP or ImageMagick to convert the image
convert image.ppm image.jpg
This program reads a number N from stdin and generates a PPM image with resolution NxN
This is the standard Sierpinski Carpet fractal, if you don't want my fractal:
a,b,c,x,y;main(){scanf("%d",&a);printf("P5 %d %d 1 ",a,a);for(;b!=a*a;b++){x=b%a;y=b/a;c=1;while(c&&x||y){c&=!(x%3&1&&y%3&1);x/=3;y/=3;}putchar(c);}}
The build process will generate some warnings about: