Why can’t the generals face each other?
The two generals may share a file only if a piece stands between them. Exposing an empty file between them is an illegal move.
將馬帥
Test the position after the move
The red horse in the diagram has the shape of several possible moves, but all would take it off the center file. None is legal because the two generals would face each other.
Look for open files in endgames
Before moving the only blocker, check both ends of the file. When moving a general sideways, check whether the destination puts it on the other general’s file with nothing in between.