Hi : I understand the main idea beside the bitboards, but don't know how to implement it..
I'm working in C and by example I have:
uint64_t allPieces, whitePawns,blackPawns, etc..
how to fill the bitboard allPieces with the initial position?
tks
How to implement allPieces bitboard?
Moderators: Harvey Williamson, Watchman
Re: How to implement allPieces bitboard?
You just set the bits in white_pawns that represent the 8 squares a2, b2, c2, ..., h2 to "1", all others are set to "0"...notosil wrote:Hi : I understand the main idea beside the bitboards, but don't know how to implement it..
I'm working in C and by example I have:
uint64_t allPieces, whitePawns,blackPawns, etc..
how to fill the bitboard allPieces with the initial position?
tks
BTW it is probably better to have BITBOARD pawns[2], with pawns[0] being black pawns, and pawns[1] being white pawns... simplifies things later.
-
- Member
- Posts: 20
- Joined: Mon Oct 29, 2007 10:28 pm
- Location: Hattingen, Germany
Re: How to implement allPieces bitboard?
allPieces is simple the union of all other piece bitboards. Dependent on the mapping, allPieces has likely the value of 0xffff00000000ffff for the initial position. You will also keep the union of all white and black pieces as well. While doing/undoing moves, it is faster to update those redundant union-sets incrementally rather than to "or" them all together each time the piece-bitboards change.notosil wrote:Hi : I understand the main idea beside the bitboards, but don't know how to implement it..
I'm working in C and by example I have:
uint64_t allPieces, whitePawns,blackPawns, etc..
how to fill the bitboard allPieces with the initial position?
tks
See the chess-programming wiki for further information:
http://chessprogramming.wikispaces.com/Bitboards
-
- Member
- Posts: 4
- Joined: Tue Mar 09, 2010 10:39 am
All Pieces is simple the union of all other piece bit boards. Dependent on the mapping,All Pieces has likely the value of 0xffff00000000ffff for the initial position. You will also keep the union of all white and black pieces as well. While doing/undoing moves, it is faster to update those redundant union-sets incrementally....