Computer Chess Club Archives




Subject: Re: What approach do you use to handle castling/en passant for repetition?

Author: Daniel Clausen

Date: 15:01:44 02/28/00

Go up one level in this thread


On February 28, 2000 at 17:04:13, William Bryant wrote:

>I am curious,
>do you hash a different constant for each of the 16 possible ep squares, or
>simply a single constant if ep is possible.

Although I'm not really the one the question was directed to, I'll answer.
Hope you don't mind. :)
You should use more than just a constant if EP is possible, since you
can't always conclude WHAT ep-move is possible from the position alone.
EP to the left or to the right may be possible so you need to store more
than just a single constant. I have a random[64] array I xor to the
hash-value if EP on a certain square is possible. I think this solves
this pretty nice. [Don't forget to reset the EP-flag and update the
hash-value accordingly.]

>I have sixteen different values that are XOR'ed into the hash signature
>depending on which square is the ep square.

Now that you mention 16 I realize that my 64 are a bit overkill..
oh well. It's easier in a bitboard engine.

>It is intersting that Bruce made a comment about this a while back.  He noted
>that the same opening position reached by a different order of moves will
>produce a different hash signature doing ep squares in this way.  Therefore it
>does create a degree of inefficiency because (except for the ep move) the rest
>of the position may have already been evaluated and in the hash table.

Not sure if we have the same discussion in mind. What I remember is the
following. Bruce suggested to set the EP-flag after a double-step move
of a pawn ONLY if the opponent has pawns adjacent to it which ALLOW him
to make an EP search.

Consider the initial position after the moves E2-E4, E7-E5. There's no sense
in setting the EP-flag because there's no white pawn on D5 of F5 which could
possibly capture E5 en passant.
Now consider the initial position and the moves E2-E3, E7-E6, E3-E4, E6-E5.
Again the same position appears. If you stored the first position with the
EP-flag set you won't have the same hash-value here now, and therefore won't
get a hash-hit.

Kind regards,

This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.