What prevents chess engines from being undetectable? I see accounts of people getting banned from sites like chess.com for using engines like Stockfish and Komodo (I admit I have used these engines before, but never in an actual match). Now, I believe there are certain characteristics of these engines that make them easy to detect.  One I heard is the way you move the King, as well as every move being the best move possible (This one could be wrong). But I was thinking... couldn't chess engines not do the things that make them detectable, like play Kings less randomly, play sub-optimal moves in between optimal ones, etc, and become basically, as far as I can notice, undetectable? Is there anything about the way they are programmed that make this impossible or is this because of legality and morality?
Engines have no concept of natural moves and they have no fear. An engine will play for the most advantage, not for the most manageable advantage, even if it allows a fierce attack, because it sees that the attack does not work, while a human would probably prevent an attack and settle with a smaller, but practical advantage.

&quot;Randomly&quot; picking good moves is not easy. The second best move may only be second best if you see a very hard ONLY MOVE which comes 15 moves after. And sometimes, the best move is very obvious, and playing the second best move would be very suspicious.

It is not very known how engine detections on chess websites work, but I have read that they also account for playstyle inconsistency (ultra-aggressive to defensive, even though an aggressive move is available and not much worse), mouse movement, time management.