I have a pseudo-legal movegen. Thinking about it, it's easy in pseudo-legal movegens too.rtitle wrote:Actually, if your move generator generates only legal moves (not pseudo-legal moves), then #1 is easy to implement.
Yes, but you always want to detect repetitions and probe TT *BEFORE* generating moves... So this is horrible from a performance point of view.rtitle wrote:...Therefore, the following algorithm is sufficient:
position->generate_moves(movelist /* output arg */);
if (movelist contains any e.p. captures)
/* don't bother transcribing it's hash to whatever you're using to detect repetitions; it can't repeat */;
else
hash position and transcribe hash to history for detecting repetitions
Then at the point where you want to detect if a move leads to a repletion:
position->make_move(move);
hash position and look up in the history to detect if you've reached a repetition
Rich
You can do this: when making a double pawn push, in makemove check if the ep capture is legal (simply remove pushed pawn and the adiacent pawn and see if king is in check, if there are two pawns do this check for both), if it's legal then you set the ep square, else you don't. That's the same as Option 1, as you will set the ep square only on pawn pushses that allows effectively legal ep moves, but is this worth? I mean, you are moving a legality test one ply earlier for (maybe) slightly better TT probes and chances are that you would never needed to do that check because a pawn ep capture is usually bottom in the captures list, so a cut off could occur, and you just did an expensive legality test when none were required... Statistically speaking, how many double pushes cannot lead to ep capture because pawn is pinned on king??? I bet low numbers are involved here, so it will probabilty hurt than help.
Natale.