One benefit of a fast evasion generator is its use at interior search nodes where special move ordering may be obtained at the generation stage. E.g., capturing a single attacker, moving the king, interposing vs a single ray attacker, and finally en passant capture. Using that generation sequence could mean skipping all other move ordering for that node.lauriet wrote:Thats a good point. At the moment I have a legal move generator, which checks each generated move to see if the king is still in check.......this appears to be dumb, so I will work on changing this AND then your suggestion will help from there on in.
But even for a perft() only program which needs no move ordering, a specialized evasion generator pays off with a significant time savings.
At regular nodes, it can be handy to keep track of pinned men. My program Symbolic keeps two bitboards for this: a pinned bitboard (all pinned men; some might move along the pin direction) and a frozen bitboard (the pinned men which can't move at all). It takes time to do this, but the payback is much easier legal-move-only generation including evasion generation.
So when the Symbolic's move generator spits out a vector of moves, the rest of the program knows for certain that all the moves are legal and no further testing is needed. And that makes coding easier for everything downstream from the move generator.