PieceLists ?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

MahmoudUthman
Posts: 234
Joined: Sat Jan 17, 2015 11:54 pm

PieceLists ?

Post by MahmoudUthman »

Is there any advantage to using a piece list based position representation alongside bit boards ? anyone who tested the speed difference with/without ?
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: PieceLists ?

Post by Henk »

MahmoudUthman wrote:Is there any advantage to using a piece list based position representation alongside bit boards ? anyone who tested the speed difference with/without ?
Bit boards fine. Magic bit boards probably waste of time.
lauriet
Posts: 199
Joined: Sun Nov 03, 2013 9:32 am

Re: PieceLists ?

Post by lauriet »

I added piece lists to my x088 engine with very good results.
Somethings work well with one data structure, somethings with the other,
so you can combine the best of both worlds.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: PieceLists ?

Post by Evert »

A bitboard performs essentially the same function as a piecelist anyway. What would adding a piecelist give you that bitboards don't do already?
abulmo2
Posts: 433
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: PieceLists ?

Post by abulmo2 »

MahmoudUthman wrote:Is there any advantage to using a piece list based position representation alongside bit boards ? anyone who tested the speed difference with/without ?
Bitboards are a way to represent piecelists, so they are redundant with another representation. A redundant piece lists may be worth on system where bitboards are not very performant (32 bit system), though.
Richard Delorme
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: PieceLists ?

Post by Henk »

abulmo2 wrote:
MahmoudUthman wrote:Is there any advantage to using a piece list based position representation alongside bit boards ? anyone who tested the speed difference with/without ?
Bitboards are a way to represent piecelists, so they are redundant with another representation. A redundant piece lists may be worth on system where bitboards are not very performant (32 bit system), though.
When looking up what piece is on a particular square it is probably faster to look it up in an array than in a set of bit boards. How many bit boards are there ? Five or six perhaps.
abulmo2
Posts: 433
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: PieceLists ?

Post by abulmo2 »

Henk wrote:
abulmo2 wrote:
MahmoudUthman wrote:Is there any advantage to using a piece list based position representation alongside bit boards ? anyone who tested the speed difference with/without ?
Bitboards are a way to represent piecelists, so they are redundant with another representation. A redundant piece lists may be worth on system where bitboards are not very performant (32 bit system), though.
When looking up what piece is on a particular square it is probably faster to look it up in an array than in a set of bit boards. How many bit boards are there ? Five or six perhaps.
Yes, this the weak point of bitboards and a piece array is usually used to store the content of the chess board. Note that piece lists alone suffers from the same problem.
Bitboard are good at storing the position of each pieces, thanks to cpu instructions like bsf or bsr and very usefull to do fast move generation, with magic bitboard, kindergarten, or whatever algorithm.
Richard Delorme
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: PieceLists ?

Post by phhnguyen »

Henk wrote: When looking up what piece is on a particular square it is probably faster to look it up in an array than in a set of bit boards. How many bit boards are there ? Five or six perhaps.
I don't think there is a winner between checking 16 item-array and 6 bitboards since the number of IFs is about 3 times as many.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: PieceLists ?

Post by Evert »

abulmo2 wrote: Bitboard are [...] very usefull to do fast move generation, with magic bitboard, kindergarten, or whatever algorithm.
Actually, it's very hard to beat the raw performance of a well-written mailbox move generator. Bitboard serialisation is not particularly fast and magic bitboards consume a fair chunk of cache space. A mailbox uses a very tight inner loop and little memory access (just the board).

Where bitboards shine is in letting you intersect the piece list with particular sets: all rooks that are on open files, all enemy queens that align with our king. All knights that are able to fork two pieces. Or doing bulk operations on pawns, or detecting evaluation patterns.
Karlo Bala
Posts: 373
Joined: Wed Mar 22, 2006 10:17 am
Location: Novi Sad, Serbia
Full name: Karlo Balla

Re: PieceLists ?

Post by Karlo Bala »

Henk wrote:
abulmo2 wrote:
MahmoudUthman wrote:Is there any advantage to using a piece list based position representation alongside bit boards ? anyone who tested the speed difference with/without ?
Bitboards are a way to represent piecelists, so they are redundant with another representation. A redundant piece lists may be worth on system where bitboards are not very performant (32 bit system), though.
When looking up what piece is on a particular square it is probably faster to look it up in an array than in a set of bit boards. How many bit boards are there ? Five or six perhaps.
Piece list and board array are two different things. Piece list is list of piece coordinates (max 32). Board array is array of squares.
Best Regards,
Karlo Balla Jr.