Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Generating Bitboard attack list

Author: Thorsten Greiner

Date: 07:07:41 06/06/04

Go up one level in this thread


On June 06, 2004 at 09:23:10, Gopikrishna wrote:

>In the following code,
>
>piecebd=WhiteQueens;
>      while (piecebd) {
>      from=LastOne(piecebd);
>      moves=AttacksQueen(from);
>      temp=from+(queen<<12);
>      while (moves) {
>        to=LastOne(moves);
>        move_list[i++]=temp+to<<6;
>        Clear(to,moves);
>      }
>      Clear(from,piecebd);
>    }
>
>We are generating moves that queen attacks from the "from" square.But later we
>are calculating some temp and then later adding it with "to" to create move
>list.Why are we doing this? Also I dont follow why we are doing queen<<12 and
>to<<6.The code is in http://www.cis.uab.edu/info/faculty/hyatt/bitmaps.html
>Thanks.

Obviously Bob uses an integer to store the moves. It seems that he stores the
piece to moves starting a bit 12, the from square at bit 0 and the to square at
bit 6 like this:

bit index    012345   6789ab   cdef
           +--------+--------+-------+
           | from   | to     | piece |
           +--------+--------+-------+

In the loop above the from square and the piece do not change, so he can
calculate the loop invariant temp=from | (piece << 12) before the loop.



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.