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 

Another Sliding Piece Move Generator -> BlockerTable Look
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Srdja Matovic



Joined: 10 Mar 2010
Posts: 310
Location: Hamburg - Germany

PostPost subject: Another Sliding Piece Move Generator -> BlockerTable Look    Posted: Thu Jun 14, 2012 5:40 pm Reply to topic Reply with quote

i am sure someone else tested this before....and my first implementation is slower than magic bitboards...anyway..

The Idea is to compute for every piece and all 8 directions the possible sliding-blockers and check this table against an precomputed AttackTable.

Here some pseudocode:

Code:
BlockerTable[9*64]      // precomputed sliding-blockers
DirectionTable[4096]    // from-to direction table
AttackTables[2*7*64]    // precomputed attack tables

bbBlockersDirection[9]  // BitBoards for dummy and 8 direction-BlockedMap


// *** Move Generator ***

// create blocked map

for every piece do {

    pos = getPiecePos();

    bbBlockersDirection[1]  |= BlockerTable[1*64+pos];
    bbBlockersDirection[2]  |= BlockerTable[2*64+pos];
    bbBlockersDirection[3]  |= BlockerTable[3*64+pos];
    bbBlockersDirection[4]  |= BlockerTable[4*64+pos];
    bbBlockersDirection[5]  |= BlockerTable[5*64+pos];
    bbBlockersDirection[6]  |= BlockerTable[6*64+pos];
    bbBlockersDirection[7]  |= BlockerTable[7*64+pos];
    bbBlockersDirection[8]  |= BlockerTable[8*64+pos];


}

// create moves
for every own piece do {

    from = getPiecePos();

    piece = getPieceType();

    // Get Pseudo-Legal Attacks
    bbTemp  = AttackTables[(som*7*64)+(piece*64)+from];

    // TODO: pawn handling

   
    while( bbTemp )

        to = pop_1st_bit(bbTemp);

        // Legality Attack Test, Test if slider is blocked
        if ( IsSlider?(piece) && ( SetMaskBB[to] & bbBlockersDirection[DirectionTables[from*64+to]] ) )
            continue;

        // make and store move

    }
}
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Subject Author Date/Time
Another Sliding Piece Move Generator -> BlockerTable Look Srdja Matovic Thu Jun 14, 2012 5:40 pm
      Re: nervermind Srdja Matovic Thu Jun 14, 2012 6:10 pm
      Re: Another Sliding Piece Move Generator -> BlockerTable H.G.Muller Sat Jun 16, 2012 8:45 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