Piece-list representation

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

Re: Piece-list representation

Postby Sune Fischer » 17 Jul 2005, 19:21

So if I get that right, to insert a queen you move the first rook to the back of rooks, the first bishop to the back of bishops and so on, to make room for new queen and when deleting you do the opposite?

Is this faster than shifting the whole array?

-S
User avatar
Sune Fischer
 
Posts: 126
Joined: 07 Oct 2004, 11:12
Location: Denmark

Re: Piece-list representation

Postby Reinhard Scharnagl » 17 Jul 2005, 19:44

When promoting I detach the pawn from the list and insert a queen or rook etc. at a matching place I search from king, which is always the first piece in each list.

Reinhard.
Reinhard Scharnagl
 
Posts: 608
Joined: 01 Oct 2004, 08:36
Location: Klein-Gerau, Germany

Re: Piece-list representation

Postby Dann Corbit » 18 Jul 2005, 19:19

Alessandro Scotti wrote:I'm now considering using a double linked list where each piece belongs to two lists: a list of pieces of same color, and a list of pieces of same color and type.
{snip}


Consider a skiplist, which gives random access and automatically sorts the entries.
Dann Corbit
 

Re: Piece-list representation

Postby Dan Andersson » 19 Jul 2005, 01:43

Different ADTs have different strengths. Doubly linked lists have nice effective properties when it comes to making and unmaking changes in backtracking searches like depth-first search. See for example the efficient use in Knuth's 'Dancing Links' paper:
http://www-cs-faculty.stanford.edu/~knu ... olor.ps.gz
Dan Andersson
 
Posts: 1
Joined: 30 Jun 2005, 15:52

Previous

Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 32 guests