Author: Gerd Isenberg
Date: 03:57:37 09/21/04
Go up one level in this thread
On September 21, 2004 at 04:02:45, Russell Reagan wrote:
>On September 21, 2004 at 02:05:08, Tony Werten wrote:
>
>>Pawn are still a problem I think, since the solution is not much nicer:
>>
>>( assuming the compiler understands the a negative shl is a shr )
>>
>>BLACK=0
>>WHITE=1
>>
>>int LeftSideAttack={-9,7};
>>int RightSideAttack={-7,9};
>>
>>pieces=Pieces[stm][pawn];
>>
>>pawnattacks=(pieces & NOT_FILE_A)<<LeftSideAttack[stm]
>> |(pieces & NOT_FILE_H)<<RightSideAttack[stm])
>>
>>AttackedPieces=pawnattacks & Pieces[stm^1][all]
>>
>>Hmm, actually writing it down, makes it less messier than it was in my head.
>>That is, if the first assumption is met.
>
>I believe it is "implementation defined" in C.
>
>If you want to substitute math for logic, you could try something like this.
>
>enum { white, black };
>
>// pawn moves forward
>pawnMoves = (pawns << 8) >> (16 * side);
Yes, this "generalized" shift by one rank works well for pawns, because they
don't occupy first or eight rank.
BitBoard pawnPushTargets(BitBoard pawns, int side) {
return (pawns << 8) >> (16 * side);
}
What about left and right pawn attacks with this trick?
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.