void tta_ai_algorithm(struct disp_grid_81* disp,struct tic_tac_ai* tta, int player){
	//knowing that the player is an AI, we run AI algoirthm
	if (player == 1){
		ai_evaluate_board(&tta->game,&tta->ai_1);
		ai_play_best_move(&tta->game,&tta->ai_1,disp);
        ai_evaluate_board(&tta->game,&tta->ai_1);
		//ai_print_grid_eval(&tta->ai_1);
	}
	else if (player == -1){
		ai_evaluate_board(&tta->game,&tta->ai_2);	
		ai_play_best_move(&tta->game,&tta->ai_2,disp);
        ai_evaluate_board(&tta->game,&tta->ai_2);	
		//ai_print_grid_eval(&tta->ai_2);
	}
}
Exemple #2
0
int read_ai_command(ai* self, char** cmd) {

    char *sq = (char*)malloc(sizeof(char)*3),
         name = (self->player_c == BLACK_C) ? 'N' : 'B';

    ai_play_best_move(self, &sq);

    (*cmd)[0] = name;
    (*cmd)[1] = sq[0];
    (*cmd)[2] = sq[1];
    (*cmd)[3] = '\0';

#if VERBOSE_AI
    printf("AI: My command is \"%s\".\n", *cmd);
#endif

    return 0;
}