If there's a chess bot and I changed how the bishop moves so it can move through pieces can it beat me without the need to change the code?
2 Answers
No, at least if you're intending to use the rule change in your advantage. For instance, you could threat the enemy queen with pawns between them and there's no way for the computer to be aware of the danger, who will just let you take their queen for free. Think for instance 1.d4 d5 2.Bg5 and how is the computer supposed to know that it must move the queen away?
There are also situations where the computer would have to stop playing. After 1.e4 e5 2.Bb5 the computer will suggest an illegal move, as it doesn't know that ...Ke7 is the only legal move.
Since it's not aware of the rule change, it will also never use the rule tweak in its advatnage, so any reasonably skilled chess player would win the game easily.
There are engines that can play chess variants when told the rules in some chess variant description language. I think Fairy-Stockfish is the most widely used one. The github page for it claims that master-level strength can commonly be achieved just by giving it the rules of a user-defined chess variant, without adjusting it in any way. It claims that superhuman strength is usually possible when a fully trained NNUE network is used for evaluation. A training data generator is also available on github.
Disclaimer: I haven't used these tools myself, but I find these claims plausible. Fairy-Stockfish is used e.g. on lichess to provide computer opponents for various chess variants, and these computer opponents are known to be very strong, but I think these use NNUE networks to obtain a strong evaluation function.