/* This program loops through various
   random characters and numbers to
   produce a "Matrix-like" effect.
*/

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <conio.c>
/* #include <dos.h> */
#include <io.h>

#define SIZE1 20

void sleep(float nbr_secs);

int main()
{
   int x;

   textcolor(2);

   puts("\n\n\n\n\n\t\t\tWELCOME TO THE MATRIX");
   fflush(stdout);
   sleep((float) 3);
   clrscr();

   puts("\n\n\n\n\n\t\t\t  There is no spoon.");
   fflush(stdout);
   sleep((float) 3);
   clrscr();

   srand((unsigned)time(NULL));

   for(;;)
     {
	textcolor(2);
		
        printf("\n\n\n\n");

        for(x = 1; x <= SIZE1; x++)
        {
	   int r0 = rand()%32767;
	   int r1 = rand()%32767;
	   int r2 = rand()%32767;
	   int r3 = rand()%32767;
			

    	   char c0 = rand()%256;
	   if (c0 == '\a'){

	/* gets rid of random bell sound */

	   continue;
	 }

         char c1 = rand()%256;
         if (c1 == '\a'){
		continue;
		}
	  char c2 = rand()%256;
	  if (c2 == '\a'){
		continue;
		}
	  char c3 = rand()%256;
	  if (c3 == '\a'){
		continue;
		}
	  char c4 = rand()%256;
	  if (c4 == '\a'){
	        continue;
		}

   printf("\t%d%c%c%c%c%c",»
	   r0, c0, c1, c2, c3, c4);
   printf("\t%d%c%c%c%c%c",»
	   r1, c1, c2, c3, c4, c0);
   printf("\t%d%c%c%c%c%c",»
	   r2, c2, c3, c4, c0, c1);
   printf("\t%d%c%c%c%c%c\n",»
	   r3, c3, c4, c0, c1, c2);
			 
   fflush(stdout);
   sleep((float) .150);
			
	}

	clrscr(); 

	if(kbhit())
	{
		break;
	}
    }

	system("PAUSE");		
       	return 0;
}

/* void sleep(float nbr_secs)
   causes the pause between "WELCOME..."
   and "There is no spoon." 
*/

void sleep(float nbr_secs)
{
	clock_t goal;

	goal = (nbr_secs * CLOCKS_PER_SEC)»
	+ clock();

	while(goal > clock())
	{
		;
	}
}


:: Top ::

code dog Tucker
E2 logo
End Poverty
Debt AIDS Trade Africa
World Community Grid
Valid XHTML 1.0 Transitional