Page 1 of 1

Dynamic EP flag

Posted: Fri Oct 02, 2015 6:49 pm
by thevinenator
i was looking through the CPW code and found some code that is used to optimize whether or not to set the EP flag after a pawn move.

the description given follows:

/* en-passant flag
First erase the current state of the ep-flag, then set it again
in case there has been a two square pawn move that allows such
capture. For example, 1.e4 in the initial position will not set
the en passant flag, because there are no black pawns on d4 and f4.
This soluion helps with opening book and increases the number of
transposition table hits.
*/

i can see why the flag is not necessary if there isn't a pawn that can recapture, but I don't understand how the claims would help otherwise. can two positions be identical with the only difference that the EP flag is set or not? can someone explain if this is valid?

Re: Dynamic EP flag

Posted: Sat Oct 03, 2015 5:30 am
by hyatt
You MUST include ep status in a hash position signature, you can't allow two identical positions to map to the same hash entry if one of them has a possible EP capture and the other does not. The simple solution is that any double pawn push triggers the ep flag and modifies the hash signature for one move. But most double pawn pushes don't allow EP captures, so treating a position reached by (say) e4 differently from the same position reached by e3 and then e4 would make you miss the transposition.

That's what this is about..