Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: en-passant move generation

Author: James Long

Date: 09:07:16 02/06/99

Go up one level in this thread


On February 06, 1999 at 11:35:56, Larry Griffiths wrote:

>Hi!
>
>I am looking for suggestions on how to test for and generate en-passant
>moves.  I have been thinking along these lines:
>
>   1) Was the last move a pawn moving two squares forward.
>   2) Is the From square a pawn and is it adjacent to the To square
>      of the previous ply's move.
>   3) If the pawn on the From square is not pinned, then
>      en-passant move is valid.
>
>Any other ideas or suggestions are appreciated!
>Thanks in advance!
>
>Larry :}


In my movegen, the following code is used for ep captures:

      // ep capture
      if (EP != Square::Invalid)
      {
         pieceboard.Set(bpawn[EP] & WPawns);
         while(pieceboard.Data())
         {
            m->setSource((Square::LocationType)pieceboard.MSB());
            pieceboard.Xor(mask[m->Source()]);
            m->setDest(EP);
            m->setMover(Piece::WhitePawn);
            m->setCaptured(Piece::BlackPawn);
            m->setSpecial(Move::EpCapture);
            m->setScore(PAWN_VALUE);
            m++;
         }
      }

"EP" is a macro:
#define EP           position.EPSquare().Location()

I set the "ep square" anytime a double pawn move is made,
so that after 1. e4, "e3" is the "ep square."

During the move generation, look for a pawn that is in
position to capture on the ep square (regardless of what
is there).  I don't check for the pin at this stage.  After
the move is made I lok for a captured king.


---
James



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.