home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / UTILITIE / CHAOS.ZIP / CHAOS.C next >
Text File  |  1989-03-17  |  907b  |  53 lines

  1. #include "stdio.h"
  2. #include "graph.h"
  3.  
  4. struct POINT {
  5.     int x;
  6.     int y;
  7. };
  8.  
  9.  
  10. main()
  11.  
  12. {
  13.     struct  POINT   point[3];
  14.     struct  POINT   halfp;
  15.     long    int     counter;
  16.     int     r_corner;
  17.  
  18.     _setvideomode(_VRES16COLOR);
  19.     _setcolor(3);
  20.  
  21.     point[0].x = 0;
  22.     point[0].y = 0;
  23.     point[1].x = 639;
  24.     point[1].y = 0;
  25.     point[2].x = 319;
  26.     point[2].y = 479;
  27.  
  28.  
  29.     for (counter=0; counter<3; counter++)
  30.         _setpixel(point[counter].x, point[counter].y);
  31.  
  32.     halfp.x = rand() % 640;
  33.     halfp.y = rand() % 480;
  34.  
  35.     _setpixel(halfp.x, halfp.y);
  36.  
  37.     for (counter=0; counter<200000; counter++) {
  38.         r_corner = rand() % 3;
  39.         halfp.x = (halfp.x + point[r_corner].x) / 2;
  40.         halfp.y = (halfp.y + point[r_corner].y) / 2;
  41.  
  42.         _setpixel(halfp.x, halfp.y);
  43.  
  44.      }
  45.  
  46.  
  47.  
  48.     getch();
  49.     _setvideomode(_DEFAULTMODE);
  50.  
  51. }
  52.  
  53.