I did some experiments with the search mode in Tenjiku Shogi. The test position was basically that after 1.P-j6 (except that I first did two Leopard moves to get it out of book). At level 'medium' it would normally see the mate threat, and play 1... SE-n11.
First I disabled legality testing altogether. Then it doesn't defend against the mate threat, and even after 2.VGo10# it plays on, and only conceeds after I capture the King. Not good. This could have been expected; King capture occurs two ply after checkmate, and GenerateMoves already tests for it when it discovers there are no legal moves. I moved the testing for missing King from the Evaluation (which would make it to be discovered only after the King capture was played) to the move generation, where it declares a win if a move is generated that captures a King. That did still not make it see the mate threat at this level.
Now chess games in general are not won because you see checkmate from a larger distance, but by gaining so much material that the opponent cannot see checkmate no matter how deep he searches, as he is too weak to inflict it, so that sooner or later you will stumble into one. But Tenjiku Shogi is sort of an exception to this, with these jumping generals that threaten mate even on a full board.
So I tried something else: test the pseudo-legal moves for legality until you find a legal one, then accept all others without testing. This way you will always discover it when you are (check or stale)mated. But in the common case (where you are not, and not even in check) the very first move you generate is already very likely legal, so that you on average will hardly subject more than a single move to this check test.
Unfortunately it still did not defend against the mate threat after this. But when I execute the mate though 2.VG-10o#, it claims a draw. Turns out that in the place where it tries the moves with cbQuickApply, to test them for legality, it also tests whether those that turn out to be legal do deliver check. It stores that in the move, and when the move is played to create a new position, it takes its in-check info from there. So by skipping this for most moves it would not know anymore that it is in check, and thus judges that the situation without legal moves is a stalemate. (And apparently I forgot to let it know that in Tenjuku stalemate is a win too.) It is thus hardly amazing that it doesn't worry about that; draw with gote is a good result.
So in the code for deriving the game result when there are zero legal moves I let it do a check test if the in-check status was still undefined. That solved it: it plays 1... SE-n11 again.
But that it doesn't check all moves for legality means that it will also highlight the illegal moves at game level, except when by coincidence it was the first move that was generated (or in any case not preceded by any legal moves). This allows you to step into check, or stay in check. (Unless you are already checkmated through moves that its check test understands. Then it declares game end and you cannot move anything at all.) In Tenjiku Shogi this would of course be allowed, and improves the uniformity of the highlighting, as you were already allowed to step into checks that the check test was blind to (burning and capture by an area move).
What is a bit odd is that when you do step into check, it declares game end, without actually performing the King capture (or allowing you to do it, in case you win).
I did some experiments with the search mode in Tenjiku Shogi. The test position was basically that after 1.P-j6 (except that I first did two Leopard moves to get it out of book). At level 'medium' it would normally see the mate threat, and play 1... SE-n11.
First I disabled legality testing altogether. Then it doesn't defend against the mate threat, and even after 2.VGo10# it plays on, and only conceeds after I capture the King. Not good. This could have been expected; King capture occurs two ply after checkmate, and GenerateMoves already tests for it when it discovers there are no legal moves. I moved the testing for missing King from the Evaluation (which would make it to be discovered only after the King capture was played) to the move generation, where it declares a win if a move is generated that captures a King. That did still not make it see the mate threat at this level.
Now chess games in general are not won because you see checkmate from a larger distance, but by gaining so much material that the opponent cannot see checkmate no matter how deep he searches, as he is too weak to inflict it, so that sooner or later you will stumble into one. But Tenjiku Shogi is sort of an exception to this, with these jumping generals that threaten mate even on a full board.
So I tried something else: test the pseudo-legal moves for legality until you find a legal one, then accept all others without testing. This way you will always discover it when you are (check or stale)mated. But in the common case (where you are not, and not even in check) the very first move you generate is already very likely legal, so that you on average will hardly subject more than a single move to this check test.
Unfortunately it still did not defend against the mate threat after this. But when I execute the mate though 2.VG-10o#, it claims a draw. Turns out that in the place where it tries the moves with cbQuickApply, to test them for legality, it also tests whether those that turn out to be legal do deliver check. It stores that in the move, and when the move is played to create a new position, it takes its in-check info from there. So by skipping this for most moves it would not know anymore that it is in check, and thus judges that the situation without legal moves is a stalemate. (And apparently I forgot to let it know that in Tenjuku stalemate is a win too.) It is thus hardly amazing that it doesn't worry about that; draw with gote is a good result.
So in the code for deriving the game result when there are zero legal moves I let it do a check test if the in-check status was still undefined. That solved it: it plays 1... SE-n11 again.
But that it doesn't check all moves for legality means that it will also highlight the illegal moves at game level, except when by coincidence it was the first move that was generated (or in any case not preceded by any legal moves). This allows you to step into check, or stay in check. (Unless you are already checkmated through moves that its check test understands. Then it declares game end and you cannot move anything at all.) In Tenjiku Shogi this would of course be allowed, and improves the uniformity of the highlighting, as you were already allowed to step into checks that the check test was blind to (burning and capture by an area move).
What is a bit odd is that when you do step into check, it declares game end, without actually performing the King capture (or allowing you to do it, in case you win).