Skip to content Skip to sidebar Skip to footer

Game Ai Works Powerfully On One Side And Becomes Dumb On The Other In Tic-tac-toe

I am trying to make a Tic-Tac-Toe game in Python using PyGame and the MiniMax algorithm. The AI plays really well when given the first chance (playing as 'X'), but becomes dumb eno

Solution 1:

best_score = -float('inf')  # Least possible score

you need to vary this according to the player for which you calculate the move. I think because of this the negative player is choosing random/first plausible move.

I have implemented minimax and related heuristics like 2 times, and always found that using the "negamax" approach worked best, since you don't need to worry about when to apply max and when min based on the player.

Post a Comment for "Game Ai Works Powerfully On One Side And Becomes Dumb On The Other In Tic-tac-toe"