Questions about tic tac toe
Hello guys, I'm planning to create a simple tic tac toe game, user vs computer and I want to make the computer to never lose
I'm planning to create this in Java, but since java and C++ are quite similar, I decided to ask you here about this problem
I have created a simple game where I can play with myself, for example I put a X and O where I want and get the final result etc
now about my problem, I can see that I have to implement the minimax algorithm, the problem is that although I understand the concept of this algorithm it's difficult for me to figure out how to code it
i want to ask the following things
1) since i've made the game user vs user, all i need is to create an extra class that will work for the computer where i will have the minimax function that will just evaluate the next move right?
2) in order to do (1) should I create an extra class for the tree, or is it better to do this recursively?
3) and if I use recursion I need to find all the states that I can go from a single state in order to use the evaluation function right?
the biggest issue that i have is the time, if I make a good recursion how much time would it actually take to find all the states? if it's more than 10 seconds, I would really choose a different way, for example the alpha beta algorithm, about the memory, I don't really have restrictions for it
thanks in advance