Relative Content

Tag Archive for algorithmartificial-intelligencetic-tac-toeminimax

Tic tac toe game blocking player moves with minimax algorithm implementation

I’ve implemented the minimax algorithm to this tic tac toe game, and it’s working well so far in terms of “Knowing how to win”. However, the computer still can’t figure out how to prevent me from winning it doesn’t see threats that I make it’s merely focused on himself winning.
[As an example, here the computer (X) tried to go for the first-row win, I (O) have placed my first move in the center then went for board0][2] cell preventing the computer’s win. Now I’m only one move away from winning but the computer instead of blocking my win tried going for the first column win.