diff --git a/play/play.c b/play/play.c index 688a1ffb605597d5985ff9ea116d5a3ed0a4fc47..51f5bf830cebe08355d4f47c8901f5a3d734bc16 100755 --- a/play/play.c +++ b/play/play.c @@ -468,7 +468,7 @@ void make_move(board brd, bool turn, int *i, int *j) *j = tmp_j; } -void best_move(board brd, bool machine_starts, bool prun) +void best_move(board brd, bool prun) { int best_score = _MIN_INF_; move bst_move; @@ -490,7 +490,7 @@ void best_move(board brd, bool machine_starts, bool prun) add_to_board(brd, i + 1, j + 1, PC); // find max score - int score = (prun) ? mini_max_alpha(brd, machine_starts, 0, &alpha, &beta) : mini_max(brd, !machine_starts, 0); + int score = (prun) ? mini_max_alpha(brd, false, 0, &alpha, &beta) : mini_max(brd, false, 0); // undo move add_to_board(brd, i + 1, j + 1, (char)0); @@ -646,7 +646,6 @@ void player_vs_smart_ai_mini_max(board brd, bool prun) printInColor("blue", "who starts the game :\n"); printInColor("white", "[1] : you\n[2]: Machine ? \n"); int t; - bool machin_start = false; scanf("%d", &t); if (t == 1) @@ -656,7 +655,6 @@ void player_vs_smart_ai_mini_max(board brd, bool prun) else { turn = true; - machin_start = true; } while (!win) @@ -666,7 +664,7 @@ void player_vs_smart_ai_mini_max(board brd, bool prun) { if (turn) { - best_move(brd, machin_start, prun); + best_move(brd, prun); print_board(brd); if (evaluate(brd) == 1) diff --git a/play/play.h b/play/play.h index 48d8edda19e8f3d1b5a50facdf15cfaefac3290a..a448396f75ce0bd764e4e6602889bb0a9fd719b1 100755 --- a/play/play.h +++ b/play/play.h @@ -34,7 +34,7 @@ bool board_is_full(board brd); int mini_max(board brd, bool is_max, int depth); int mini_max_alpha(board brd, bool is_max, int depth, int *alpha, int *beta); -void best_move(board brd, bool machine_starts, bool prun); +void best_move(board brd, bool prun); void two_player(board brd); void player_random_AI(board brd);