Constraints can target the engine, the player, or both. Shareable via URL (FEN + constraints + ELO encoded as query params).
Pre-loaded challenge if you want to skip setup:
https://constrainedchess.vercel.app/?skill=5&c=player%7Ccan%...
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://constrainedchess.vercel.app/?fen=2b1kb2%2F8%2F8%2F8%...
Yes this is what I'm saying. Evaluation can be way more than just "slightly off" though and can make the evaluation MUCH weaker because it might go down "ply-routes" that aren't just suboptimal - they simply wouldn't work at all.
For example thinking it had a "move set" that lead to a checkmate but the final ply involves a bishop that is five squares away per my rule constraint mentioned earlier.
It's fine for fun but the statement that "Stockfish's skill level applies correctly" is not a true one at any moderate level of play. (above 1200 ELO).
That's why I suggested looking into Fairy which supports runtime rule variations.