TalkChess.com
Hosted by Your Move Chess & Games

Author Message
Srdja Matovic

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

Post subject: Another Sliding Piece Move Generator -> BlockerTable Look    Posted: Thu Jun 14, 2012 5:40 pm

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     } }
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
Subject Author Date/Time
Srdja Matovic Thu Jun 14, 2012 5:40 pm
Srdja Matovic Thu Jun 14, 2012 6:10 pm
H.G.Muller Sat Jun 16, 2012 8:45 am

 Jump to: Select a forum Computer Chess Club Forums----------------Computer Chess Club: General TopicsComputer Chess Club: Tournaments and MatchesComputer Chess Club: Programming and Technical DiscussionsComputer Chess Club: Engine Origins Other Forums----------------Chess Thinkers ForumForum Help and Suggestions
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