Beispiel #1
0
int main (void)
{
	char gameboard[BOARD_SIZE][BOARD_SIZE];
	
	initialize_array(gameboard);
	
	print_board(gameboard);
	while(!(is_board_full(gameboard) ) )
	{
		player1_turn(gameboard);	
		player2_turn(gameboard);
	}
	switch(decide_winner(gameboard) )
	{
	case 1:
		printf("Player One (X) Wins!!!\n\n");
		break;
	case 2:
		printf("Player Two (O) Wins!!!\n\n");
		break;
	case 3:
		printf("Tie Game!!!\n\n");
		break;		
	return 0;
	}
}
Beispiel #2
0
void board1(void)
{
    //prints("helloworld", 0, 0, 1,1.5);
    make_space();
    init_player(2, 2000);
    
    player1_position = 0;
    player2_position = 0;
    
    //DEBUG TEST
    
    do {
        if (player[1] > 0) {
            player1_turn();
#ifdef __APPLE__
			sleep(1);
#else
            Sleep(1000);
#endif
        }
        else
            printf("Player[1] is bankrupted, skip\n\n");
        
        if (player[2] > 0) {
            player2_turn();
#ifdef __APPLE__
			sleep(1);
#else
            Sleep(1000);
#endif
        }
        else
            printf("Player[2] is bankrupted, skip\n\n");
        
        
    } while (player[1] > 0 || player[2] > 0);
    
    
    //analysis
    printf("\n\n");
    for (int i=0; i<40; i++) {
        if (space[i].occupy_condition == -1 || space[i].occupy_condition == 0) {
            printf("[%d]%s is owned by the Mother Nature\n",i, space[i].space_name);
        }
        else
        	printf("[%d]%s is owned by Player[%d]\n",i, space[i].space_name, space[i].occupy_condition);
    }
    
    
    
    
    
    //dice_ui(-1, 1);
    
}