ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

New simple and fast bitboard move generator
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Michael Sherwin



Joined: 26 May 2006
Posts: 2215
Location: OH, USA

PostPost subject: New simple and fast bitboard move generator    Posted: Sat May 05, 2007 3:52 pm Reply to topic Reply with quote

Code:
u32 RookIndex(u32 sq, u64 occ) {
    return = indexN[sq][FirstBit(occ & bitsN[sq])]
           | indexE[sq][FirstBit(occ & bitsE[sq])]
           | indexS[sq][LastBit (occ & bitsS[sq])]
           | indexW[sq][LastBit (occ & bitsW[sq])];
}


Since, bsf/bsr is very fast on core 2 this should be very competitive, in both 32 bit mode and 64 bit mode.

A rook on a1 only needs 3 bits + 3 bits = 6 bits of index, to hold the bit placements for the two directions. A rook on e4 needs 2 + 2 + 2 + 2 = 8 bits for the four directions. Remember not to include the final destination edge square.

This has the huge advantage that no 64 bit multiplication needs to be done and no shift back into place as well. Also it requires smaller lookup tables!

The returned index can be used to look up the mobility as well as the attack set.
_________________
Regards,
Mike
Back to top
View user's profile Send private message
Display posts from previous:   
Subject Author Date/Time
New simple and fast bitboard move generator Michael Sherwin Sat May 05, 2007 3:52 pm
      Re: New simple and fast bitboard move generator Gerd Isenberg Sat May 05, 2007 5:43 pm
            Re: New simple and fast bitboard move generator Gerd Isenberg Sun May 06, 2007 8:52 am
                  Re: New simple and fast bitboard move generator Michael Sherwin Sun May 06, 2007 10:31 am
                        Re: New simple and fast bitboard move generator Gerd Isenberg Sun May 06, 2007 11:16 am
                              Re: New simple and fast bitboard move generator Michael Sherwin Sun May 06, 2007 1:21 pm
                                    Re: New simple and fast bitboard move generator Gerd Isenberg Sun May 06, 2007 1:52 pm
                                          Re: New simple and fast bitboard move generator Michael Sherwin Sun May 06, 2007 3:15 pm
                              Re: New simple and fast bitboard move generator Michael Sherwin Sun May 06, 2007 10:29 pm
                                    Re: New simple and fast bitboard move generator Gerd Isenberg Mon May 07, 2007 8:40 am
                                          Re: New simple and fast bitboard move generator Michael Sherwin Mon May 07, 2007 11:06 am
                                          Re: New simple and fast bitboard move generator Gerd Isenberg Mon May 07, 2007 8:08 pm
                                                Re: New simple and fast bitboard move generator Gerd Isenberg Mon May 07, 2007 11:22 pm
                                                      Re: New simple and fast bitboard move generator Michael Sherwin Tue May 08, 2007 3:18 am
                                                            Re: New simple and fast bitboard move generator Gerd Isenberg Tue May 08, 2007 6:11 am
                                                Re: New simple and fast bitboard move generator Michael Sherwin Tue May 08, 2007 9:25 pm
                                                      Re: New simple and fast bitboard move generator Michael Sherwin Tue May 08, 2007 10:55 pm
                                                      Re: New simple and fast bitboard move generator Gerd Isenberg Wed May 09, 2007 3:18 am
                                                            Re: New simple and fast bitboard move generator Tony Wed May 09, 2007 6:10 am
                                                                  Re: New simple and fast bitboard move generator Michael Sherwin Wed May 09, 2007 7:47 am
                                                                        Re: New simple and fast bitboard move generator Tony Wed May 09, 2007 8:24 am
                                                      Re: New simple and fast bitboard move generator Gerd Isenberg Wed May 09, 2007 7:31 pm
                                                            Re: New simple and fast bitboard move generator Michael Sherwin Wed May 09, 2007 11:30 pm
            Re: New simple and fast bitboard move generator Tony Mon May 07, 2007 6:46 am
                  Re: New simple and fast bitboard move generator Gerd Isenberg Mon May 07, 2007 8:51 am
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
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
Enhanced with Moby Threads