# Can a tic tac toe AI work at a depth of 3?

My question might be confusing but let me elaborate. I’ve already asked this question before and haven’t recieved an answer, with the question being closed for being unclear. This was the question with a bit of editing:

So, my assignment was to think of a good evaluation function so that the Tic Tac Toe AI we have designed using the Minimax algorithm would be unbeatable. The limits we had were to not change the source code for the rest of the game, and that the lowest depth of the game tree at which the AI was supposed to function flawlessly had to be 3. For example, calling the minimax function with a depth of 3 should work the same as calling it with the depth of 8. My question is, can a tic tac toe AI even function with that shallow of a depth? This was my algorithm, but it led me to believe that it requires more depth to be able to predict ahead enough, seeing as it was beaten in some very specific cases.

public int Evaluate()
{

if (CurrentState.over != 0)
return (CurrentState.over == 1) ? 40 - CurrentState.SpotsTaken() : -40 + CurrentState.SpotsTaken();

int count = 0;
if (CurrentState.Field(0, 0) != 0)
count += (CurrentState.Field(0, 0) == 1) ? 2 : -2;
if (CurrentState.Field(0, 2) != 0)
count += (CurrentState.Field(0, 2) == 1) ? 2 : -2;
if (CurrentState.Field(2, 0) != 0)
count += (CurrentState.Field(2, 0) == 1) ? 2 : -2;
if (CurrentState.Field(2, 2) != 0)
count += (CurrentState.Field(2, 2) == 1) ? 2 : -2;
if (CurrentState.Field(1, 1) != 0)
count += 4 * ((CurrentState.Field(1, 1) == 1) ? 2 : -2);

return count;
}

The idea is that the corners are worth the least "points", but some nonetheless, the center is worth more "points", with winning being worth the most "points". the CurrentState is the state being evaluated, with CurrentState.Field being the game board. The value of a cell of the game board is 0 if the spot is not taken, 1 if there's an X, and 2 if there's an O. CurrentState.over is 1 if the game is over and if the winning player is X, 2 if the winning player was O, and 0 if it's a draw.

So what do you guys think? Can it work with that shallow of a depth or does it require a depth of at least 4? Seeing as it works flawlessly with a depth of 4. I will answer questions immediately if something is unclear.