home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
UTILITIE
/
CHAOS.ZIP
/
CHAOS3.C
< prev
next >
Wrap
Text File
|
1989-03-21
|
1KB
|
70 lines
#include "stdio.h"
#include "math.h"
#include "graph.h"
struct POINT {
int x;
int y;
};
main()
{
struct POINT point[20];
struct POINT halfp;
long int counter;
int r_corner;
int num;
double points;
double pie = 3.141593;
double c;
int i = 0;
system("CLS");
printf("Enter the number of points to define the object: ");
if (scanf("%d", &num) == 0)
exit();
points = (double) num;
_setvideomode(_VRES16COLOR);
_setcolor(4);
for (c = 0; c < (pie * 2.0); c += (pie * 2.0) / points) {
point[i].x = (int) (320.0 + (sin(c) * 220.0));
point[i].y = (int) (240.0 + (cos(c) * 220.0));
i++;
}
for (counter=0; counter<3; counter++)
_setpixel(point[counter].x, point[counter].y);
#if FALSE
halfp.x = rand() % 640;
halfp.y = rand() % 480;
#endif
halfp.x = 320;
halfp.y = 240;
_setpixel(halfp.x, halfp.y);
for (counter=0; counter<200000; counter++) {
r_corner = rand() % num;
halfp.x = (halfp.x + point[r_corner].x) / 2;
halfp.y = (halfp.y + point[r_corner].y) / 2;
_setpixel(halfp.x, halfp.y);
}
getch();
_setvideomode(_DEFAULTMODE);
}