hi all, in game search tree there are many algorithms to get the optimal solution, like minimax algorithm. I start learn how to solve this problem with minimax algorithm, the algorithm clear. but I'm confused about the tree itself, in games like tic tac toe number of node not very huge, but on others like chess there are many nodes. i think this need large space in memory. So is there any algorithms to evaluate and build tree in the same time?
A tree of game states is not normally built as a complete data structure. Instead, states are evaluated as they are created, and most are discarded in the process. Often, a linked-list from the state being evaluated back to the current state of the game is maintained. But if one move is shown to be much better than another, then the entire line for the poor move will be discarded, so it will occupy no space in memory.
One simple way to search the state space for a game like chess is to do the search recursively to a given depth. In that case, very few game states actually exist at one time, and those that do exist are simply referenced on the call-stack. More sophisticated algorithms will create a larger tree, but (especially for chess) none will maintain a tree of all possible states. For chess, a breadth-first search may be better, using a queue rather than a stack, and this will maintain only states at a certain depth in the tree. Even better would be a priority queue in which the best states are stored for further evaluation, and the worst states are discarded completely.