King.is_in_check_after_move calls game.copy() and then make_move() for every candidate move generated by every piece, then generates the full opponent move list.
For an RLM engine that just plays random legal moves, this is fine and not worth fixing yet — flagging for visibility if/when search depth ever becomes a goal. At that point, copy-on-write or a make/unmake pattern will be necessary.
King.is_in_check_after_movecallsgame.copy()and thenmake_move()for every candidate move generated by every piece, then generates the full opponent move list.For an RLM engine that just plays random legal moves, this is fine and not worth fixing yet — flagging for visibility if/when search depth ever becomes a goal. At that point, copy-on-write or a make/unmake pattern will be necessary.