suragnair / alpha-zero-general

A clean implementation based on AlphaZero for any game in any framework + tutorial + Othello/Gobang/TicTacToe/Connect4 and more
MIT License
3.74k stars 1.01k forks source link

A bug in MCTS #268

Closed TheMessik closed 2 years ago

TheMessik commented 2 years ago

I am writing chess AI with this library and I can't help but notice that in MCTS.py, the valid moves are only ever requested for player 1: https://github.com/suragnair/alpha-zero-general/blob/018f65ee1ef56b87c8a9049353d4130946d03a9a/MCTS.py#L86

I am wondering if this is by design, and if so, proposing a change in the documentation, so that the getCanonicalForm method returns the board from the perspective of the passed player value.

My understanding of getValidMoves() method is that the board and player values are the current state of the board and the player to play. Ergo it makes little sense to be requesting valid moves for only one player (and it made writing my network that much harder, because I was trying to hunt down a bug in my code)

TheMessik commented 2 years ago

Consider this a non-issue