Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: SPEED !!! help a novice chess programmer =)

Author: Scott Gasch

Date: 21:59:28 06/17/02

Go up one level in this thread


On June 18, 2002 at 00:57:35, Dann Corbit wrote:

>On June 18, 2002 at 00:39:41, Adriano Bedeschi de Souza wrote:
>
>>BitBoard bishopMoves(ChessPosition position, int orig) {
>>
>>    int diagonalState;
>>    BitBoard diagonal_A8H1_moves;
>>    BitBoard diagonal_A1H8_moves;
>>    BitBoard pos;
>>
>>    pos = position.rotated45L;
>>    pos = pos >> rotated45Left_shift_map[orig];
>>    diagonalState = pos & (int)(pow(2,diagonal_A8H1_length[orig]) - 1);
>                                 YIKES
>>
>>    diagonal_A8H1_moves = diagonal_A8H1_attacks[orig][diagonalState];
>>
>>    pos = position.rotated45R;
>>    pos = pos >> rotated45Right_shift_map[orig];
>>    diagonalState = pos & (int)(pow(2,diagonal_A1H8_length[orig]) - 1);
>                                 YIKES
>>
>>    diagonal_A1H8_moves = diagonal_A1H8_attacks[orig][diagonalState];
>>
>>    return diagonal_A8H1_moves | diagonal_A1H8_moves;
>>}
>
>Maybe something like this instead:
>unsigned long long p2[] = {
>    0x1,
>    0x2,
>    0x4,
>    0x8,

Also try 1 << power




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.