How does Minmax algorithm works? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How does Minmax algorithm works?

So related to the above algo if I have a current state as ["X","O",null, "O","X",null, "X",null,"O"] Now if I check the possible states for "X" they are ["X","O","X", "O","X",null, "X",null,"O"] ["X","O",null, "O","X","X", "X",null,"O"] ["X","O",null, "O","X",null, "X","X","O"] The first one completes the pattern in diagonal i.e. for "X" and wins the game ,so do I need to check for further states by subdividing the other two states?, I saw someone doing that and I am confused why they did it if we already got the best move we can make! Any help is much appreciated,ty!

8th Nov 2020, 1:54 PM
Abhay
Abhay - avatar
3 Answers
+ 2
It is called pruning. Cutting off states you don't need to check since you got your minimum or maximum value. Check out videos on YouTube on min-max pruning algorithms. Happy Coding 😀
8th Nov 2020, 3:24 PM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 1
"If you don't want to win"? As humans, yes but I am not sure the ai will know this. It is either min or max value. The ai will want to win and worst case scenario, draw. I am sure it wont want a draw 😃 with them it is either True or False. No "there is some element of truth in it" 🤣🤣
8th Nov 2020, 4:07 PM
Tomiwa Joseph
Tomiwa Joseph - avatar
0
Tomiwa Joseph thank you 😊 ,but we can explore other states as well if we don't want to win and want to take the game to draw ,right?
8th Nov 2020, 3:31 PM
Abhay
Abhay - avatar