#include <io.h>
#include <system.h>
#include <stdio.h>
#include <time.h>

int main()
{
	  time_t timer;
	  struct tm y2k;
	  double seconds;

	  y2k.tm_hour = 0;   y2k.tm_min = 0; y2k.tm_sec = 0;
	  y2k.tm_year = 2000; y2k.tm_mon = 0; y2k.tm_mday = 1;

	  time(&timer);  /* get current time; same as: timer = time(NULL)  */
	  long int t = static_cast<long int> time(NULL);
	  seconds = difftime(timer,mktime(&y2k));

	  printf ("%.f seconds since January 1, 2000 in the current timezone", seconds);

	  return 0;


}
//
//#define IOWR_SRAM_DATA(base, offset, data) \
//  IOWR_16DIRECT(base, (offset) * 2, data)
//#define IORD_SRAM_DATA(base, offset) \
//  IORD_16DIRECT(base, (offset) * 2)
//#define IOWR_SRAM_SPEED(base, data) \
//  IOWR_16DIRECT(base + 32, 0, data)
//
//int main()
//{
//
//    int flag = 0;   // use to determine what state are we
//
//
//    int gameTime = 0;   // time count
//    int score = 0;  // score count
//
//    int deadFlag;  //indicates player has been created
//    int playerXCoordinate;   //player's leftmost upmost coordinate
//    int playerYCoordinate;
//    int life;   //indicate how many life still left
//
//    int bossFlag;    //indicates boss has been created
//    int bossXCoordinate; //boss's leftmost upmost coordinate
//    int bossYCoordinate;
//
//    int enemyCount; // number of enemies in the screen up to 8 enemies
//
//    int enemyFlag[9];
//    int enemyXCoordinate[9];  //enemies' leftmost upmost coordinate
//    int enemyYcoordinate[9];
//
//    int bulletFlag; //indicate bullet created
//    int bulletXCoordinate;
//    int bulletYCoordinate;
//
//
//    int hitXCoordinate; //where to put on hit effect
//    int hitYCoordinate;
//
//    int collisionXCoordinate;   //where to put on collision effect
//    int collisionYCoordinate;
//
//    int gameoverXCoordinate;    //where to put on game over picture
//    int gameoverYCoordinate;
//
//    int playerXSpeed;
//    int playerYSpeed;
//    int enemyXSpeed;
//    int enemyYSpeed;
//    int bossXSpeed;
//    int bossYSpeed;
//    int bulletXSpeed;
//
//    int xLowBound = 0;
//    int xHighBound = 640;
//    int yLowBound = 0;
//    int yHighBound = 480;
//    //int sound = 0;
//
//    int counter;	//increase the time of the loop
//    int shine =0;
//    //int silence = 0;
//    //int sound = 0;
//
//
//    //int soundByte = IORD_16DIRECT(audio_BASE, 0);
//    //printf(soundByte);
//
//    //flag = GET_FLAG get flag from hardware
//
//
//    playerXCoordinate = 40;
//	playerYCoordinate = 50;
//	bossXCoordinate = 600;
//	bossYCoordinate = 200;
//	bulletXCoordinate = 600;
//	bulletYCoordinate = 480;
//
//	playerYSpeed = -2;
//	bossXSpeed = 1;
//	bossYSpeed = 5;
//	bulletXSpeed = 2;
//
//	deadFlag = 0;
//
//	counter = 10000;
//	int i = 0;
//
//	for(i = 0; i < 10; i++){
//		enemyFlag[i] = 0;
//	}
//	enemyCount = 0;
//	bossFlag = 0;
//
//
//
//
//
//
//
//    if (flag == 0) {
//
//        //implement normal procedure(move down the player)
//
//    	time_t initTime;
//    	time_t now;
//    	double seconds;
//    	time(&initTime);
//    	//initTime = time();
//
//
//
//        for (; ; ) {
//
//        	//printf("%d", time);
//        	counter--;
//
//        	if(counter == 0){
//
//        		counter = 100000;
//        		time(&now);
//        		seconds = difftime(now, initTime);
//        		printf ("%.f seconds since game starts\n", seconds);
//        		//time and score grow
//        		gameTime = gameTime + 1;
//        		//display time
//        		//IOWR_SRAM_DATA(VGA_BASE,,time);
//
//				score = score + 10;
//				//display score
//				//IOWR_SRAM_DATA(VGA_BASE,,score);
//
//
//
//
//				//player moving
//				if(playerYCoordinate - yLowBound <= 10){
//					playerYSpeed = - playerYSpeed;
//				}
//				if(yHighBound - playerYCoordinate <= 90){
//					playerYSpeed = - playerYSpeed;
//				}
//
//				playerYCoordinate = playerYCoordinate - playerYSpeed;
//
//				//super mode after dead
//				if(deadFlag == 1){
//					if(shine == 30){
//						IOWR_SRAM_DATA(VGA_BASE, 2, 800);
//						IOWR_SRAM_DATA(VGA_BASE, 13, 800);
//						shine = shine + 1;
//					}else if(shine == 60){
//						IOWR_SRAM_DATA(VGA_BASE, 2, 800);
//						IOWR_SRAM_DATA(VGA_BASE, 13, 800);
//						shine = shine + 1;
//					}else if(shine == 90){
//						IOWR_SRAM_DATA(VGA_BASE, 2, 800);
//						IOWR_SRAM_DATA(VGA_BASE, 13, 800);
//						shine = shine + 1;
//					}else if(shine == 120){
//						IOWR_SRAM_DATA(VGA_BASE, 2, 800);
//						IOWR_SRAM_DATA(VGA_BASE, 13, 800);
//						shine = shine + 1;
//					}else if(shine == 150){
//						IOWR_SRAM_DATA(VGA_BASE, 2, 800);
//						IOWR_SRAM_DATA(VGA_BASE, 13, 800);
//						shine = shine + 1;
//					}else if(shine == 180){
//						IOWR_SRAM_DATA(VGA_BASE, 2, 800);
//						IOWR_SRAM_DATA(VGA_BASE, 13, 800);
//						deadFlag = 0;
//					}else{
//						IOWR_SRAM_DATA(VGA_BASE, 2, playerXCoordinate);
//						IOWR_SRAM_DATA(VGA_BASE, 13, playerYCoordinate);
//						shine = shine + 1;
//					}
//				}else{
//					IOWR_SRAM_DATA(VGA_BASE, 2, playerXCoordinate);
//					IOWR_SRAM_DATA(VGA_BASE, 13, playerYCoordinate);
//				}
//
//
//
//
//
//				//enemy created
//				if(rand()%100 > 98 && enemyCount < 10){
//					//rand is from 0-99, thus 0.01% runs created enemy
//					//create enemy of No.(enemyCount + 1)
//					enemyCount++;
//					//assign enemy position
//					enemyFlag[enemyCount] = 1;
//
//				}
//
//
//				//enemy engaging
//				for(i = 0; i < 10; i++){
//					if(enemyFlag[i] == 1){
//						enemyXCoordinate[i] = enemyXCoordinate[i] - enemyXSpeed;
//						if(enemyXCoordinate[i] < 0){
//							enemyFlag[i] = 0;
//						}
//						//give it to hardware
//					}
//				}
//
//
//
//				//boss created
//				if(gameTime > 200 && gameTime < 210 && bossFlag == 0){
//					//create boss
//					bossFlag = 1;
//					deadFlag = 1;
//					//assign position
//
//			        IOWR_SRAM_DATA(VGA_BASE, 0, bossXCoordinate);
//			        IOWR_SRAM_DATA(VGA_BASE, 15, bossYCoordinate);
//				}
//
//				//boss engaging
//				if(bossFlag == 1){
//
//			        if(bossYCoordinate - yLowBound <= 10){
//			        	bossYSpeed = -bossYSpeed;
//			        }
//			        if(yHighBound - bossYCoordinate <= 90){
//			        	bossYSpeed = -bossYSpeed;
//			        }
//
//
//					bossXCoordinate = bossXCoordinate - bossXSpeed;
//					bossYCoordinate = bossYCoordinate + bossYSpeed;
//
//					if(bossXCoordinate < 0){
//						bossFlag = 0;
//
//				        IOWR_SRAM_DATA(VGA_BASE, 0, 800);
//				        IOWR_SRAM_DATA(VGA_BASE, 15, 800);
//					}else
//					{
//
//						//give it to hardware
//				        IOWR_SRAM_DATA(VGA_BASE, 0, bossXCoordinate);
//				        IOWR_SRAM_DATA(VGA_BASE, 15, bossYCoordinate);
//					}
//
//
//				}
//
//
//
//				// create bullet
//		        if(bulletXCoordinate == 600){
//		        	bulletXCoordinate = 80;
//		        	bulletYCoordinate = playerYCoordinate + 50;
//		        	bulletFlag = 1;
//		        }
//
//				//bullet engaging
//				if(bulletFlag == 1){
//
//					bulletXCoordinate = bulletXCoordinate + bulletXSpeed;
//
////					if(bulletXCoordinate > xHighLimit){
////						bulletFlag = 0;
////					}
//					//give it to hardware
//
//			        IOWR_SRAM_DATA(VGA_BASE, 1, bulletXCoordinate);
//			        IOWR_SRAM_DATA(VGA_BASE, 14, bulletYCoordinate);
//				}
//
//
//				//hit happens
//				//f (bossFlag == 1 && bulletXCoordinate == enemyXCoordinate1 && bulletYcoordinate == enemyYcoordinate1) {
//
//						//assign hit position
//
//						//score = score + 100;
//
//						//create hitposition
//
//						//give it to hardware
//					//}
//
//					//implement rest of the enemy hit
//
//					//}
//
//
//				//collision happens
//				if(deadFlag == 40){
//					//assign collision happens
//
//
//					life = life - 1;
//
//					//create collision effect
//					//give it to hardware
//				}
//
//				//game over happen
//				if(life == 0){
//					//create game over
//					printf("no life. Game over");
//					//give it to hardware
//				}
//
//
//
//				//finish game
//				if(gameTime > 10000){
//					// player survive
//					score = score + life * 1000;
//					//printf("250s time has past. Game over");
//					// give it to hardware
//				}
//
//
//        	}
//
//
//        }
//
//
//
//
//
//
//
//
//
//
//
//    }else if(flag == 1){
//        //implement move procedure(move up the player)
//    }
//    else{
//        //implement shot procedure(create bullet)
//    }
//}
