The more complicated answer is that (a) the legal moves are hardcoded into the potential outputs and (b) Stockfish's neural nets aren't very deep and aren't going out-of-distribution relative to their training data. It's more like an ant than a brooding general human.
Stockfish Chess Engine: Hardcoded Moves and Shallow Neural Networks
By
–
Leave a Reply