This question already has an answer here:
I've been working on a bot for a game involving dice throws and chance. The architecture involved is similar to AlphaZero in the that it has Convolutions and MCTS. According to the current state achieved, there's a possibility that all actions might not be allowed, some might be invalid for that certain state.
How do I handle these actions? When the bot is trained, it can directly select the valid action with the highest score, but how do I handle it in training? Is it useful to teach the network which moves are valid and which aren't, or is it better to simply select the valid move with the highest score at every pass?
Is this answer here specific to the kind of game being proposed or is it something always observed, that it is better to not add penalties for invalid moves?
Also, what does it mean to set the probability of the invalid moves to zero, as mentioned here?