> That function runs client-side and filters the list of legal UCI moves before being passed to Stockfish's searchmoves parameter, so Stockfish's skill level, depth, and randomness all still apply correctly within the allowed set.Hmmm... I can immediately think of a reason this won't work.
If I create a constraint that says "Bishops are only capable of moving 4 squares maximum", the set of valid moves you are passing into Stockfish only affects the initial move.
But as soon as it starts to build the minimax-equivalent search tree, it's no longer enforcing that constraint.
To make this work, you’d have to get Stockfish to continuously enforce the “bishop move” rule at every ply during its search.
Caveat - unless this is something you are enforcing in searchmoves? I don't have a lot of experience with in-depth usage of Stockfish.
Alternatively, you could look into Fairy-Stockfish, which allows you to define rule variants.
https://fairy-stockfish.github.io