'How do I fix the random selection and apply a minimax algorithm for choice?
for this TIC TAC TOE game, I'm new to coding so I'm not sure how can change the A.I to play more intelligently, I know it's with the use of a minimax algorithm and utilities but i'm unsure on how to implement that into the player.
"apply a minimax strategy to select the minimum possible utilities. Here are the endgame case utilities: X winning case (Human) : +1 O wining case (DeepBlue) : -1 Tie case : 0."
void PlayerDeepBlue() { // Robot playing
int choice;
srand(time(0));
cout << "DeepBlue playing randomly..." << endl;
do {
choice = rand()%9 + 1; // random values between 1 and 9
} while (State[choice] != EMPTY_MARK);
State[choice] = O_MARK;
PrintState();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
