Example #1
0
//main
	int main(){
		int hour,min,met;
		hour=min=met=-1;
		int N,option;
		printf("What is the accurancy of the clock? : ");
		scanf(	"%d",&N);
		Node *head=malloc(sizeof(Node));
		head->next=NULL;
		head->data=0;
		createClock(N,head);
		//printList(head);			
					
		while(1){	
		printf("\nOptions:\n0.Exit\n1.(Re)Start clock\n2.Set alarm\n3.When pointers met\n");
		scanf("%d",&option);				
		
			switch (option){
			
				
			case 0:
			printf("You exited the program..bb..\n");
			freeMem(head);
			return 1;
			break;
			
			case 1:		
			//run(N,head,option);
			start=1;
			runClock(N,head,-50,-50,-50);	//-50 is set as a no input						
			break;
			
			case 2:			
			printf("Set alarm hour:\n");
			scanf("%d",&hour);
			printf("Set alarm minute:\n");
			scanf("%d",&min);
			start=1;
			runClock(N,head,hour,min,-50);
			break;
			
			case 3:			
			printf("Press 1 if you want to find when pointers met or ctr+C to go to global menu\n");
			scanf("%d",&met);			
			start=met=1;
			runClock(N,head,-50,-50,met);
			break;
			
			}
		}
		
		
		return 1;		
		
	
}
/*
 *Creates game structure.  Needs to be run in level init
 */
GameProperties createGame()	{

	GameProperties newGame = (GameProperties) malloc(sizeof(*newGame));
	newGame->clock = createClock();

	newGame->totalMemory=1000;
	newGame->memoryUsed=0;
	newGame->currWaveNo=0;
	newGame->totalWaveNo = 0;
	newGame->health=100;
    newGame->costOfNewTower = 300;
	newGame->deathCount = 0;
	newGame->clock->start_t  = newGame->clock->lastAction = (double) clock()/CLOCKS_PER_SEC;
	newGame->createEnemyGroupDelay=0;
	getGame(newGame);
	return newGame;

}