#include <iostream>
#include <unistd.h>
#include <time.h>
#include <cstdlib>
#include "ball.h"
#include "ansi.h"


using namespace std;


int main(void) {
 Ball b;
 int count=0;

 //seed the random number generator
 srand(time(0));

 cout << clearScreen << cursorOff;
 b.reset();   //start the ball rolling

 while(true) {

   b.draw();
   count++;


   if(count%10 == 0) {
     srand(time(0));
     cout << clearScreen;
     b.reset();
   }

   //delay
   usleep(500000);
   b.erase();
   b.update();
 }
}