HIARCS Chess Forums Forum Index HIARCS Chess Forums
World Championship winning computer chess software program & downloads for chess database, analysis and play on PC, Mac and iPhone
 
 QuestionsQuestions   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Private MessagesPrivate Messages   Log inLog in 

How to implement allPieces bitboard?

 
Post new topic   Reply to topic    HIARCS Chess Forums Forum Index -> Programming Discussions
View previous topic :: View next topic  
Author
notosil



Joined: 30 Dec 2007
Posts: 1

PostPosted: Sun Dec 30, 2007 2:24 pm    Post subject: How to implement allPieces bitboard? Reply with quote

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
Back to top
View user's profile Send private message
bob
Member


Joined: 13 Oct 2007
Posts: 29

PostPosted: Tue Jan 01, 2008 4:58 pm    Post subject: Re: How to implement allPieces bitboard? Reply with quote

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


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"...

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.
Back to top
View user's profile Send private message Send e-mail
Gerd Isenberg
Member


Joined: 29 Oct 2007
Posts: 19
Location: Hattingen, Germany

PostPosted: Tue Jan 01, 2008 5:17 pm    Post subject: Re: How to implement allPieces bitboard? Reply with quote

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

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.

See the chess-programming wiki for further information:
http://chessprogramming.wikispaces.com/Bitboards
Back to top
View user's profile Send private message
glenntamis
Member


Joined: 09 Mar 2010
Posts: 4

PostPosted: Tue Mar 09, 2010 10:50 am    Post subject: Reply with quote

Though, honestly, I found quite a few, but as yet, I'm trying to stay away from their source code. I would like my engine to be my own creation. I realize though that sometimes certain ideas that are implemented in an engine should have their origins mentioned.
Back to top
View user's profile Send private message Send e-mail
zeeshan
Member


Joined: 28 Nov 2012
Posts: 4

PostPosted: Thu Jan 31, 2013 7:58 am    Post subject: Reply with quote

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....
_________________
www.2000caloriedietplan.com
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    HIARCS Chess Forums Forum Index -> Programming Discussions All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP