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
Tony
Guest





PostPost subject: Re: New simple and fast bitboard move generator    Posted: Wed May 09, 2007 6:10 am Reply to topic Reply with quote

Gerd Isenberg wrote:
Michael Sherwin wrote:
Would this fix the problem?

The corner squares do not matter as far as occupancy goes, so just make sure the corner bits are set.

Also make sure the appropriate corner bit is set for the direction bits.

Now there will always be at least one set bit to find!

And it takes less instructions!!

Code:
typedef struct {
  u16 idx[64];
  u64 bitsN;
  u64 bitsE;
  u64 bitsS;
  u64 bitsW;
} square;

u64 rookAttacks(u64 occ, square *sq) {
    unsigned long ln, le, ls, lw;
    occ |= fourCorners;
    _BitScanForward64(&ln, occ & sq->bitsN);
    _BitScanForward64(&le, occ & sq->bitsE);
    _BitScanReverse64(&ls, occ & sq->bitsS);
    _BitScanReverse64(&lw, occ & sq->bitsW);
    u32 idx = sq->idx[ln] | sq->idx[le] | sq->idx[ls] | sq->idx[lw];
    return rookLookup[idx];


Yes, very good - that would work!


Hmm, don't think so.

For east and west, one should use the A and H file. For N & S, 1st and 2nd rank.

It still would go wrong if the rook is on the border squares ? ie N attacks for B8 ?

Cheers,

Tony
Back to top
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