Search code examples
treeartificial-intelligence

Self play AI on the same MCTS?


I've been recently trying to play with MCTS implementation for simple board game. I'd like to make AI play with itself to gather some sample playthroughs. I'd figure out I could make them use the same MCTS tree (for better performance). Or so it looks like.

But would that be valid ? Or I need 2 separate trees for both AI with separate win/plays data to behave correctly ?


Solution

  • If you are doing self-play and building the tree exactly the same for both players there won't be any bias inherent in the tree - you can re-use it for both players. But, if the players build the MCTS tree in a way that is specific to a particular player, then you'll need to rebuild the tree. In this case you'd need to keep two trees, one for each player, and each player could re-use their own tree but nothing else.

    Some things to analyze if you're trying to figure this out:

    • Does the game have hidden information? (Something one player knows that the other player doesn't.) In this case you can't re-use the tree because you'd leak private information to the other player.
    • Do your playouts depend on the player at the root of the MCTS tree?
    • Does you have any policies for pruning moves from either player that aren't applied symmetrically?
    • Do you evaluate states in a way that is not symmetric between players?
    • Do you perform any randomization differently for the players?

    If none of these are true, you can likely re-use the tree.