# Strategy tic- tac- toe in binary options, Minimax Algorithm in Game Theory | Set 3 (Tic-Tac-Toe AI - Finding optimal move) - GeeksforGeeks

Content

Let us combine what we have learnt so far about minimax and evaluation function to write a proper Tic-Tac-Toe AI Artificial Intelligence that plays a perfect game. This AI will consider all possible scenarios and makes the most optimal move.

- It is of course impossible to win all your trades even if you follow this method accurately.
- Ways to make money online and pay list
- How to make money in your spare time
- Exercise of options
- Forex Strategy Tic Tac Toe
- За исключением нескольких хроник - возможно, чисто легендарных, человечество лишилось своего прошлого.
- Impossible to lose win binary options -
- Forex Strategy Tic Tac Toe

This function evaluates all the available moves using minimax and then returns the best move the maximizer can make. It is a simple straightforward function which checks whether a move is available or not and returns true or false respectively.

### System Message

Pseudocode is as follows : function isMovesLeft board : for each cell in board: if current cell is empty: return true return false Making our AI smarter : One final step is to make our AI a little bit smarter. Even though the following AI plays perfectly, it might choose to make a move which will result in a slower victory or a faster loss.

Lets take an example and explain it. Assume that there are 2 possible ways for X to win the game from a give board state. Even though the move A is better because it ensures a faster victory, our AI may choose B sometimes.

To overcome this problem we subtract the depth value from the evaluated score. This means that in case of a victory it will choose a the victory which takes least number of moves and in case of a loss it will try to prolong the game and play as many moves as possible.

Impossible to lose Always win - ….

The same thing must be applied to the minimizer. Instead of subtracting the depth we add the depth value as the minimizer always tries to get, as negative a value as possible. We can subtract the depth either inside the evaluation function or outside it.

Anywhere is fine. I have chosen to do it outside the function. Pseudocode implementation is as follows.