Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitboards generate moves King, Knight

Author: Russell Reagan

Date: 01:02:45 09/21/04

Go up one level in this thread


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);



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.