My Minimax doesn't always choose the best move

I described the problem also on stackoverflow, if you want

The problem is, it doesn’t always as expected. I tried to debug it, and found that in cases when it doesn’t choose the right move, it is when the score for that move is for some reason “-infinity”.

Problem solved. I don’t know, if it is possible, moderators can close this topic.

If you could describe your solution, it could help out other campers who may search for this in the future.

@PortableStick. Ok, I’ll try, but I am not a native speaker.

First my mistake was, that I used in determining what to return the number ‘1000’. I fixed it to 10. I don’t know why, I decided to go with 1000. I am talking about the part of the code where it determines who the winner is in minimax function.

Then the second mistake was, that I wasn’t considering the draw case, after I fixed these two minimax worked as needed.

To understand the algorithm I used this post, thanks to @geligelu.

Guess, that’s all.

1 Like