I'm trying to create a mcts ai for connect 5 algorithm. However, I'm confused on designing the tree. Here is a quick description of the algorithm:
The initial state, S0 is the board state where the AI places the stone, or in other words, the AI's turn. Is it correct that each node should be the AI's turn, not the humans?
In the expansion phase, you need to "create child nodes". In my game, the child nodes would each be a place where an AI can make a move. However, if I want to select the next avaliable AI move, I need to know where the enemy, or the human places the stone before the next avaliable AI move. I improvised by making it 2-layered: for every avaliable human moves, add every avaliable AI moves after the human plays. Is this the correct way to do it?
This is my current tree structure in an Example: Each state has info of where black and white "stones"are placed. the AI plays white, and Human plays black. Black plays first. state S0 would be the first move of the game.
S0(black stones:[(2,2)],white stones:[])
/ \
/ \
/ \
S1(black stones:[(2,2)],white stones:[(1,1)]) S2(black stones:[(2,2)],white stones:[(1,2)]
| |
S3(black stones:[(2,2),(2,1)],white stones:[(1,1)]) S4(black stones:[(2,2),(2,3)],white stones:[(1,2)]