numEffectState.cc
Go to the documentation of this file.
00001 /* numEffectState.cc
00002  */
00003 #include "osl/state/numEffectState.h"
00004 #include "osl/state/numEffectState.tcc"
00005 #include "osl/state/simpleState.tcc"
00006 #include "osl/effect/numSimpleEffect.tcc"
00007 
00008 #include <iostream>
00009 #include <emmintrin.h>
00010 typedef __v2di v2di;
00011 
00012 bool osl::state::operator==(const NumEffectState& st1,
00013                             const NumEffectState& st2)
00014 {
00015   assert(st1.isConsistent(true));
00016   assert(st2.isConsistent(true));
00017   if (!(st1.effects == st2.effects)) 
00018     return false;
00019   if (!(st1.pieces_onboard == st2.pieces_onboard)) 
00020     return false;
00021   if (!(st1.promoted == st2.promoted)) 
00022     return false;
00023   if (!(st1.pin_or_open == st2.pin_or_open)) 
00024     return false;
00025   if (!(st1.king_mobility == st2.king_mobility)) 
00026     return false;
00027   if (!(st1.king8infos == st2.king8infos)) 
00028     return false;
00029   return (static_cast<const SimpleState&>(st1)
00030           == static_cast<const SimpleState&>(st2));
00031 }
00032 
00033 const osl::checkmate::King8Info osl::state::
00034 NumEffectState::king8Info(Player king) const
00035 {
00036   return King8Info(Iking8Info(king));
00037 }
00038 
00039 template<osl::Player P>
00040 void osl::state::NumEffectState::makeKing8Info()
00041 {
00042   const Player altP=PlayerTraits<P>::opponent;
00043 #ifdef ALLOW_KING_ABSENCE
00044   if (kingSquare<P>().isPieceStand())
00045     return;
00046 #endif
00047   king8infos[P]=King8Info::make<altP>(*this,kingSquare<P>()).uint64Value();
00048 }
00049 
00050 osl::state::
00051 NumEffectState::NumEffectState(const SimpleState& st) 
00052   : SimpleState(st),effects(st)
00053 {
00054   pieces_onboard[0].resetAll();
00055   pieces_onboard[1].resetAll();
00056   promoted.resetAll();
00057   effects.effected_mask[0].resetAll();
00058   effects.effected_mask[1].resetAll();
00059   effects.effected_changed_mask[0].resetAll();
00060   effects.effected_changed_mask[1].resetAll();
00061   for(int num=0;num<40;num++){
00062     Piece p=pieceOf(num);
00063     if (p.isOnBoard()){
00064       pieces_onboard[p.owner()].set(num);
00065       if (p.isPromoted())
00066         promoted.set(num);
00067       for(int i=0;i<2;i++){
00068         Player pl=indexToPlayer(i);
00069         if(hasEffectAt(pl,p.square()))
00070         {
00071           effects.effected_mask[i].set(num);
00072           effects.effected_changed_mask[i].set(num);
00073         }
00074       }
00075     }
00076   }
00077   makePinOpen(BLACK);
00078   makePinOpen(WHITE);
00079   if(kingSquare<BLACK>().isOnBoard())
00080     makeKing8Info<BLACK>();
00081   if(kingSquare<WHITE>().isOnBoard())
00082     makeKing8Info<WHITE>();
00083 }
00084 osl::state::
00085 NumEffectState::~NumEffectState() 
00086 {
00087 }
00088 
00089 const osl::Piece osl::state::
00090 NumEffectState::selectCheapPiece(PieceMask effect) const
00091 {
00092   if (! effect.any())
00093     return Piece::EMPTY();
00094   mask_t pieces = effect.selectBit<PAWN>(), ppieces;
00095   if (pieces.any()) 
00096   {
00097     ppieces = pieces & promoted.getMask<PAWN>();
00098     pieces &= ~ppieces;
00099     if (pieces.any())
00100       return pieceOf(pieces.bsf()+PtypeFuns<PAWN>::indexNum*32);
00101     return pieceOf(ppieces.bsf()+PtypeFuns<PAWN>::indexNum*32);
00102   }
00103   pieces = effect.selectBit<LANCE>();
00104   if (pieces.any()) 
00105   {
00106     ppieces = pieces & promoted.getMask<LANCE>();
00107     pieces &= ~ppieces;
00108     if (pieces.any())
00109       return pieceOf(pieces.bsf()+PtypeFuns<LANCE>::indexNum*32);
00110     return pieceOf(ppieces.bsf()+PtypeFuns<LANCE>::indexNum*32);
00111   }
00112   mask_t king = effect.selectBit<KING>();
00113   effect.clearBit<KING>();
00114   if (effect.none())
00115     return pieceOf(king.bsf()+PtypeFuns<KING>::indexNum*32);
00116   // depends on current piece numbers: <FU 0>, KE 18, GI 22, KI 26, <OU 30>, <KY 32>, KA 36, HI 38, 
00117 #if OSL_WORDSIZE == 64
00118   const int index = 0;
00119 #else
00120   const int index = effect.getMask(0).any() ? 0 : 1;
00121 #endif
00122   ppieces = effect.getMask(index) & promoted.getMask(index);
00123   pieces = effect.getMask(index) & ~ppieces;
00124   const int num = pieces.any() 
00125     ? (ppieces.any() ? std::min(pieces.bsf(),ppieces.bsf()) : pieces.bsf()) 
00126     : ppieces.bsf();
00127   return pieceOf(num + index*32);
00128 }
00129 
00130 const osl::Piece osl::state::
00131 NumEffectState::findThreatenedPiece(Player P) const
00132 {
00133   assert(! inCheck(P));
00134   PieceMask pieces = piecesOnBoard(P) & effectedMask(alt(P));
00135   PieceMask nolance = pieces; nolance.clearBit<LANCE>();
00136   int pp=-1, npp=-1, ret=-1;
00137   const int lance_index = PtypeFuns<LANCE>::indexNum; // 64bit: 0, 32bit: 1
00138   for (int i=lance_index; i>=0; --i) {
00139     mask_t all = nolance.getMask(i);
00140     mask_t promoted = all & promotedPieces().getMask(i);
00141     mask_t notpromoted = all & ~promoted;
00142     if (promoted.any()) {
00143       pp = promoted.bsr() + i*32;
00144       notpromoted &= ~Ptype_Table.getMaskLow(Piece_Table.getPtypeOf(pp));
00145     }
00146     if (notpromoted.any())
00147       npp = notpromoted.bsr() + i*32;
00148     ret = std::max(pp, npp);
00149     if (ret >= PtypeTraits<KNIGHT>::indexMin)
00150       return pieceOf(ret);  
00151   }
00152   mask_t lance = pieces.selectBit<LANCE>();
00153   if (lance.any()) {
00154     mask_t plance = lance & promotedPieces().getMask(lance_index);
00155     if (plance.any())
00156       return pieceOf(plance.bsr()+lance_index*32);
00157     return pieceOf(lance.bsr()+lance_index*32);
00158   }
00159   if (ret >= 0) {
00160     assert(Piece_Table.getPtypeOf(ret) == PAWN);
00161     return pieceOf(ret);
00162   }
00163   return Piece::EMPTY();
00164 }
00165 
00166 bool osl::state::
00167 NumEffectState::wasCheckEvasion(Move last_move) const
00168 {
00169   if (! last_move.isNormal())
00170     return false;
00171   const Square from = last_move.from(), to = last_move.to();
00172   if (last_move.ptype() == KING) {
00173     if (last_move.isCapture()
00174         && hasEffectIf(last_move.capturePtypeO(), to, from))
00175       return true;
00176     return hasEffectAt(turn(), from);
00177   }
00178   if (last_move.isCapture())
00179     return hasEffectIf(last_move.capturePtypeO(), to,
00180                        kingSquare(alt(turn())))
00181       && !Board_Table.isBetweenSafe(from, to, 
00182                                     kingSquare(alt(turn())));
00183   const Piece piece = pieceOnBoard(to);
00184   if (! pin(alt(turn())).test(piece.number()))
00185     return false;
00186   if (last_move.isDrop() || last_move.oldPtype() == KNIGHT)
00187     return true;
00188   const Direction d=pinnedDir(piece);
00189   return primDir(d)
00190     !=primDirUnsafe(Board_Table.getShort8Unsafe(piece.owner(), from,to));
00191 }
00192 
00193 void osl::state::NumEffectState::makeMove(Move move)
00194 {
00195   assert(turn() == move.player());
00196   if (move.isPass()) {
00197     makeMovePass();
00198     return;
00199   }
00200 
00201   assert(isAlmostValidMove(move));
00202   const Square from=move.from();
00203   const Square to=move.to();
00204   if (from.isPieceStand())
00205   {
00206     doDropMove(to,move.ptype());
00207   }
00208   else
00209   {
00210     const Piece captured = pieceOnBoard(to);
00211     if (captured != Piece::EMPTY())
00212     {
00213       doCaptureMove(from,to,captured,move.promoteMask());
00214     }
00215     else
00216     {
00217       doSimpleMove(from,to,move.promoteMask());
00218     }
00219   }
00220   changeTurn();
00221 }
00222 
00223 void osl::state::NumEffectState::
00224 doSimpleMove(Square from, Square to, int promoteMask)
00225 {
00226   Piece oldPiece;
00227   int num;
00228   PtypeO oldPtypeO, newPtypeO;
00229   CArray<PieceMask,2> pin_or_open_backup;
00230   KingMobility king_mobility_backup;
00231   PieceMask promoted_backup;
00232   CArray<PieceMask,2> effected_mask_backup;
00233   CArray<PieceMask,2> effected_changed_mask_backup;
00234   CArray<uint64_t,2> king8infos_backup;
00235   mobility::MobilityTable mobilityTable;
00236   if (turn()==BLACK){
00237     prologueSimple(Player2Type<BLACK>(), from, to, promoteMask, 
00238                    oldPiece, num, oldPtypeO, newPtypeO, 
00239                    pin_or_open_backup, king_mobility_backup,
00240                    promoted_backup, effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable);
00241   }
00242   else{
00243     prologueSimple(Player2Type<WHITE>(), from, to, promoteMask, 
00244                    oldPiece, num, oldPtypeO, newPtypeO, 
00245                    pin_or_open_backup, king_mobility_backup,
00246                    promoted_backup, effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable);
00247   }
00248   if (promoteMask!=0 && num < PtypeTraits<PAWN>::indexLimit)
00249     clearPawn(turn(),from);
00250 }
00251 void osl::state::NumEffectState::
00252 doCaptureMove(Square from, Square to, Piece target, int promoteMask)
00253 {
00254   Piece oldPiece;
00255   PtypeO oldPtypeO, capturePtypeO, newPtypeO;
00256   int num0, num1, num1Index;
00257   mask_t num1Mask;
00258   CArray<PieceMask,2> pin_or_open_backup;
00259   KingMobility king_mobility_backup;
00260   PieceMask promoted_backup;
00261   CArray<PieceMask,2> effected_mask_backup;
00262   CArray<PieceMask,2> effected_changed_mask_backup;
00263   CArray<uint64_t,2> king8infos_backup;
00264   mobility::MobilityTable mobilityTable;
00265   if(turn()==BLACK){
00266     prologueCapture(Player2Type<BLACK>(), from, to, target, promoteMask, oldPiece, oldPtypeO, 
00267                     capturePtypeO, newPtypeO, num0, num1, num1Index,num1Mask, 
00268                     pin_or_open_backup, king_mobility_backup,
00269                     promoted_backup, effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable);
00270   }
00271   else{
00272     prologueCapture(Player2Type<WHITE>(), from, to, target, promoteMask, oldPiece, oldPtypeO, 
00273                     capturePtypeO, newPtypeO, num0, num1, num1Index,num1Mask, 
00274                     pin_or_open_backup, king_mobility_backup,
00275                     promoted_backup, effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable);
00276   }
00277   const Ptype capturePtype=target.ptype();
00278   if (capturePtype==PAWN)
00279     clearPawn(alt(turn()),to);
00280   if (promoteMask!=0 && num0<PtypeTraits<PAWN>::indexLimit)
00281     clearPawn(turn(),from);
00282 }
00283 
00284 void osl::state::NumEffectState::
00285 doDropMove(Square to,Ptype ptype)
00286 {
00287   Piece oldPiece;
00288   PtypeO ptypeO;
00289   int num, numIndex;
00290   mask_t numMask;
00291   CArray<PieceMask,2> pin_or_open_backup;
00292   KingMobility king_mobility_backup;
00293   CArray<PieceMask,2> effected_mask_backup;
00294   CArray<PieceMask,2> effected_changed_mask_backup;
00295   CArray<uint64_t,2> king8infos_backup;
00296   mobility::MobilityTable mobilityTable;
00297   if(turn()==BLACK){
00298     prologueDrop(Player2Type<BLACK>(), to, ptype, oldPiece, num, ptypeO, numIndex, numMask, 
00299                  pin_or_open_backup, king_mobility_backup,
00300                  effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable);
00301   }
00302   else{
00303     prologueDrop(Player2Type<WHITE>(), to, ptype, oldPiece, num, ptypeO, numIndex, numMask, 
00304                  pin_or_open_backup, king_mobility_backup,
00305                  effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable);
00306   }
00307   if (ptype==PAWN)
00308     setPawn(turn(),to);
00309 }
00310 
00311 template<osl::Player P>
00312 void osl::state::NumEffectState::
00313 prologueSimple(Player2Type<P>, Square from, Square to, int promoteMask,
00314                Piece& oldPiece, int& num, 
00315                PtypeO& oldPtypeO, PtypeO& new_ptypeo,
00316                CArray<PieceMask,2>& pin_or_open_backup,
00317                KingMobility& king_mobility_backup,
00318                PieceMask& promoted_backup,
00319                CArray<PieceMask,2>& effected_mask_backup,
00320                CArray<PieceMask,2>& effected_changed_mask_backup,
00321                CArray<uint64_t,2>& king8infos_backup,
00322                MobilityTable &mobility_backup)
00323 {
00324   mobility_backup = effects.mobilityTable;
00325   pin_or_open_backup = pin_or_open;
00326   king_mobility_backup = king_mobility;
00327   effected_mask_backup = effects.effected_mask;
00328   effected_changed_mask_backup = effects.effected_changed_mask;
00329   king8infos_backup=king8infos;
00330 
00331   oldPiece=pieceAt(from);
00332   Piece newPiece=oldPiece.promoteWithMask(promoteMask);
00333   newPiece+=(to-from);
00334   num=oldPiece.number();
00335 
00336   oldPtypeO=oldPiece.ptypeO();
00337   new_ptypeo=newPiece.ptypeO();
00338   // 自分自身の効きを外す
00339   setPieceOf(num,newPiece);
00340   effects.clearChangedEffects();
00341   effects.clearEffectedChanged();
00342   effects.template doEffect<NumBitmapEffect::Sub,true>(*this,oldPtypeO,from,num);
00343   // 自分自身がブロックしていたpromote?の延長
00344   // あるいは自分自身のブロック
00345   effects.effectedNumTable[num].clear();
00346   setBoard(to,newPiece);
00347   effects.template doBlockAt<NumBitmapEffect::Sub,true>(*this,to,num);
00348   setBoard(from,Piece::EMPTY());
00349   effects.template doBlockAt<NumBitmapEffect::Add,true>(*this,from,num);
00350   effects.template doEffect<NumBitmapEffect::Add,true>(*this,new_ptypeo,to,num);
00351 
00352   if (oldPtypeO == newPtypeO(P,KING))
00353     makePinOpen(P);
00354   else {
00355     Direction lastD=UL;
00356     pin_or_open[P].reset(num);
00357     recalcPinOpen(from,lastD,P);
00358     recalcPinOpen(to,lastD,P);
00359   }
00360   {
00361     Direction lastD=UL;
00362     pin_or_open[alt(P)].reset(num);
00363     recalcPinOpen(from,lastD,alt(P));
00364     recalcPinOpen(to,lastD,alt(P));
00365   }
00366   promoted_backup = promoted;
00367   if (promoteMask)
00368     promoted.set(num);
00369   if(hasEffectAt(BLACK,to))
00370     effects.effected_mask[BLACK].set(num);
00371   else
00372     effects.effected_mask[BLACK].reset(num);
00373   if(hasEffectAt(WHITE,to))
00374     effects.effected_mask[WHITE].set(num);
00375   else
00376     effects.effected_mask[WHITE].reset(num);
00377   effects.effected_changed_mask[BLACK].set(num);
00378   effects.effected_changed_mask[WHITE].set(num);
00379   {
00380     BoardMask changed=changedEffects(BLACK)|changedEffects(WHITE);
00381     changed.set(from);
00382     changed.set(to);
00383     if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare<BLACK>()))
00384        || pin_or_open[BLACK]!=pin_or_open_backup[BLACK])
00385       makeKing8Info<BLACK>();
00386     if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare<WHITE>()))
00387        || pin_or_open[WHITE]!=pin_or_open_backup[WHITE])
00388       makeKing8Info<WHITE>();
00389   }
00390 }
00391 
00392 void osl::state::NumEffectState::
00393 epilogueSimple(Square from, Square to, Piece oldPiece, 
00394                int num, PtypeO oldPtypeO, PtypeO newPtypeO,
00395                const CArray<PieceMask,2>& pin_or_open_backup,
00396                const KingMobility& king_mobility_backup,
00397                const PieceMask& promoted_backup,
00398                const CArray<PieceMask,2>& effected_mask_backup,
00399                const CArray<PieceMask,2>& effected_changed_mask_backup,
00400                const CArray<uint64_t,2>& king8infos_backup,
00401                const MobilityTable & mobility_backup)
00402 {
00403   setPieceOf(num,oldPiece);
00404   effects.doEffect<NumBitmapEffect::Sub,false>(*this,newPtypeO,to,num);
00405   setBoard(from,oldPiece);
00406   effects.effectedNumTable[num].clear();
00407   effects.doBlockAt<NumBitmapEffect::Sub,false>(*this,from,num);
00408   setBoard(to,Piece::EMPTY());
00409   effects.doBlockAt<NumBitmapEffect::Add,false>(*this,to,num);
00410   effects.doEffect<NumBitmapEffect::Add,false>(*this,oldPtypeO,from,num);
00411   effects.invalidateChangedEffects();
00412   pin_or_open = pin_or_open_backup;
00413   king_mobility = king_mobility_backup;
00414   promoted = promoted_backup;
00415   effects.effected_mask = effected_mask_backup;
00416   effects.effected_changed_mask = effected_changed_mask_backup;
00417   effects.mobilityTable = mobility_backup;
00418   king8infos = king8infos_backup;
00419 }
00420 
00421 template<osl::Player P>
00422 void osl::state::NumEffectState::
00423 prologueDrop(Player2Type<P>, Square to, Ptype ptype,
00424              Piece& oldPiece, int& num, PtypeO& ptypeO, 
00425              int& numIndex, mask_t& numMask,
00426              CArray<PieceMask,2>& pin_or_open_backup,
00427              KingMobility& king_mobility_backup,
00428              CArray<PieceMask,2>& effected_mask_backup,
00429              CArray<PieceMask,2>& effected_changed_mask_backup,
00430              CArray<uint64_t,2>& king8infos_backup,
00431              MobilityTable &mobility_backup)
00432 {
00433   king8infos_backup = king8infos;
00434   mobility_backup = effects.mobilityTable;
00435   pin_or_open_backup = pin_or_open;
00436   king_mobility_backup = king_mobility;
00437   effected_mask_backup = effects.effected_mask;
00438   effected_changed_mask_backup = effects.effected_changed_mask;
00439 #if OSL_WORDSIZE == 64
00440   numIndex=0;
00441 #elif OSL_WORDSIZE == 32
00442   numIndex=Ptype_Table.getIndex(ptype);
00443 #endif
00444   const mask_t ownMochigoma=
00445     standMask(P).getMask(numIndex) & Ptype_Table.getMaskLow(ptype);
00446   assert(ownMochigoma.any());
00447   numMask=ownMochigoma.lowestBit();
00448   int numLow = ownMochigoma.bsf();
00449   num = numLow|(numIndex<<5);
00450   oldPiece=pieceOf(num);
00451   Piece newPiece=oldPiece;
00452   newPiece+=to-Square::STAND();
00453   ptypeO=newPiece.ptypeO();
00454   setPieceOf(num,newPiece);
00455   effects.clearChangedEffects();
00456   effects.clearEffectedChanged();
00457   effects.template doBlockAt<NumBitmapEffect::Sub,true>(*this,to,num);
00458   effects.template doEffect<NumBitmapEffect::Add,true>(*this,ptypeO,to,num);
00459   setBoard(to,newPiece);
00460   standMask(P).xorMask(numIndex,numMask);
00461   stand_count[P][ptype-PTYPE_BASIC_MIN]--;
00462   pieces_onboard[P].xorMask(numIndex,numMask);
00463   {
00464     Direction lastD=UL;
00465     recalcPinOpen(to,lastD,P);
00466   }
00467   {
00468     Direction lastD=UL;
00469     recalcPinOpen(to,lastD,alt(P));
00470   }
00471   if(hasEffectAt(BLACK,to))
00472     effects.effected_mask[BLACK].set(num);
00473   else
00474     effects.effected_mask[BLACK].reset(num);
00475   if (hasEffectAt(WHITE,to))
00476     effects.effected_mask[WHITE].set(num);
00477   else
00478     effects.effected_mask[WHITE].reset(num);
00479   effects.effected_changed_mask[BLACK].set(num);
00480   effects.effected_changed_mask[WHITE].set(num);
00481   {
00482     BoardMask changed=changedEffects(BLACK)|changedEffects(WHITE);
00483     changed.set(to);
00484     if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare<BLACK>()))
00485        || pin_or_open[BLACK]!=pin_or_open_backup[BLACK])
00486       makeKing8Info<BLACK>();
00487     if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare<WHITE>()))
00488        || pin_or_open[WHITE]!=pin_or_open_backup[WHITE])
00489       makeKing8Info<WHITE>();
00490   }
00491 }
00492 
00493 template<osl::Player P>
00494 void osl::state::NumEffectState::
00495 epilogueDrop(Player2Type<P>, Square to, Ptype ptype, Piece oldPiece, 
00496              int num, PtypeO ptypeO, int numIndex, mask_t numMask,
00497              const CArray<PieceMask,2>& pin_or_open_backup,
00498              const KingMobility& king_mobility_backup,
00499              const CArray<PieceMask,2>& effected_mask_backup,
00500              const CArray<PieceMask,2>& effected_changed_mask_backup,
00501              const CArray<uint64_t,2>& king8infos_backup,
00502              const MobilityTable& mobility_backup)
00503 {
00504   standMask(P).xorMask(numIndex,numMask);
00505   stand_count[P][ptype-PTYPE_BASIC_MIN]++;
00506   pieces_onboard[P].xorMask(numIndex,numMask);
00507   setBoard(to,Piece::EMPTY());
00508   effects.template doEffect<NumBitmapEffect::Sub,false>(*this,ptypeO,to,num);
00509   effects.template doBlockAt<NumBitmapEffect::Add,false>(*this,to,num);
00510   setPieceOf(num,oldPiece);
00511   effects.effectedNumTable[num].clear();
00512   effects.invalidateChangedEffects();
00513   pin_or_open = pin_or_open_backup;
00514   king_mobility = king_mobility_backup;
00515   effects.effected_mask = effected_mask_backup;
00516   effects.effected_changed_mask = effected_changed_mask_backup;
00517   effects.mobilityTable = mobility_backup;
00518   king8infos = king8infos_backup;
00519 }
00520 
00521 template<osl::Player P>
00522 void osl::state::NumEffectState::
00523 prologueCapture(Player2Type<P>, Square from, Square to, Piece target, 
00524                 int promoteMask,
00525                 Piece& oldPiece, PtypeO& oldPtypeO, PtypeO& capturePtypeO, 
00526                 PtypeO& new_ptypeo, int& num0, int& num1, 
00527                 int& num1Index, mask_t& num1Mask,
00528                 CArray<PieceMask,2>& pin_or_open_backup,
00529                 KingMobility& king_mobility_backup,
00530                 PieceMask& promoted_backup,
00531                 CArray<PieceMask,2>& effected_mask_backup,
00532                 CArray<PieceMask,2>& effected_changed_mask_backup,
00533                 CArray<uint64_t,2>& king8infos_backup,
00534                 MobilityTable &mobility_backup)
00535 {
00536   mobility_backup = effects.mobilityTable;
00537   pin_or_open_backup = pin_or_open;
00538   king_mobility_backup = king_mobility;
00539   effected_mask_backup = effects.effected_mask;
00540   effected_changed_mask_backup = effects.effected_changed_mask;
00541   king8infos_backup = king8infos;
00542 
00543   num1=target.number();
00544   num1Index=PieceMask::numToIndex(num1);
00545   num1Mask=PieceMask::numToMask(num1);
00546   pieces_onboard[PlayerTraits<P>::opponent].xorMask(num1Index,num1Mask);
00547   standMask(P).xorMask(num1Index,num1Mask);
00548   oldPiece=pieceAt(from);
00549   Piece newPiece=oldPiece.promoteWithMask(promoteMask);
00550   newPiece+=(to-from);
00551   num0=oldPiece.number();
00552   setPieceOf(num0,newPiece);
00553   setPieceOf(num1,target.captured());
00554       
00555   oldPtypeO=oldPiece.ptypeO();
00556   new_ptypeo=newPiece.ptypeO();
00557   capturePtypeO=target.ptypeO();
00558   stand_count[P][unpromote(getPtype(capturePtypeO))-PTYPE_BASIC_MIN]++;
00559   effects.clearChangedEffects();
00560   effects.clearEffectedChanged();
00561   effects.setChangedPieces(effectSetAt(to));
00562   effects.template doEffect<NumBitmapEffect::Sub,true>(*this,capturePtypeO,to,num1);
00563   effects.template doEffect<NumBitmapEffect::Sub,true>(*this,oldPtypeO,from,num0);
00564   setBoard(from,Piece::EMPTY());
00565   effects.template doBlockAt<NumBitmapEffect::Add,true>(*this,from,num0);
00566   effects.effectedNumTable[num0]=effects.effectedNumTable[num1];
00567   effects.effectedNumTable[num1].clear();
00568   setBoard(to,newPiece);
00569   effects.template doEffect<NumBitmapEffect::Add,true>(*this,new_ptypeo,to,num0);
00570 
00571   if (oldPtypeO == newPtypeO(P,KING))
00572     makePinOpen(P);
00573   else {
00574     Direction lastD=UL;
00575     pin_or_open[P].reset(num0);
00576     pin_or_open[P].reset(num1); // captured is not pin
00577     recalcPinOpen(from,lastD,P);
00578     recalcPinOpen(to,lastD,P);
00579   }
00580   {
00581     Direction lastD=UL;
00582     pin_or_open[alt(P)].reset(num0);
00583     pin_or_open[alt(P)].reset(num1); // captured is not pin
00584     recalcPinOpen(from,lastD,alt(P));
00585     recalcPinOpen(to,lastD,alt(P));
00586   }
00587   promoted_backup = promoted;
00588   promoted.reset(num1);
00589   effects.effected_mask[BLACK].reset(num1);
00590   effects.effected_mask[WHITE].reset(num1);
00591   if (promoteMask)
00592     promoted.set(num0);
00593   if(hasEffectAt(BLACK,to))
00594     effects.effected_mask[BLACK].set(num0);
00595   else
00596     effects.effected_mask[BLACK].reset(num0);
00597   if(hasEffectAt(WHITE,to))
00598     effects.effected_mask[WHITE].set(num0);
00599   else
00600     effects.effected_mask[WHITE].reset(num0);
00601   effects.effected_changed_mask[BLACK].set(num0);
00602   effects.effected_changed_mask[WHITE].set(num0);
00603   {
00604     BoardMask changed=changedEffects(BLACK)|changedEffects(WHITE);
00605     changed.set(from);
00606     changed.set(to);
00607     if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare<BLACK>()))
00608        || pin_or_open[BLACK]!=pin_or_open_backup[BLACK])
00609       makeKing8Info<BLACK>();
00610     if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare<WHITE>()))
00611        || pin_or_open[WHITE]!=pin_or_open_backup[WHITE])
00612       makeKing8Info<WHITE>();
00613   }
00614 }
00615 
00616 template<osl::Player P>
00617 void osl::state::NumEffectState::
00618 epilogueCapture(Player2Type<P>, Square from, Square to, Piece target, 
00619                 Piece oldPiece, PtypeO oldPtypeO, PtypeO capturePtypeO, 
00620                 PtypeO newPtypeO, int num0, int num1, 
00621                 int num1Index, mask_t num1Mask,
00622                 const CArray<PieceMask,2>& pin_or_open_backup,
00623                 const KingMobility& king_mobility_backup,
00624                 const PieceMask& promoted_backup,
00625                 const CArray<PieceMask,2>& effected_mask_backup,
00626                 const CArray<PieceMask,2>& effected_changed_mask_backup,
00627                 const CArray<uint64_t,2>& king8infos_backup,
00628                 const MobilityTable &mobility_backup)
00629 {
00630   standMask(P).xorMask(num1Index,num1Mask);
00631   stand_count[P][unpromote(getPtype(capturePtypeO))-PTYPE_BASIC_MIN]--;
00632   pieces_onboard[PlayerTraits<P>::opponent].xorMask(num1Index,num1Mask);
00633   effects.effectedNumTable[num1]=effects.effectedNumTable[num0];
00634   effects.effectedNumTable[num0].clear();
00635   setPieceOf(num0,oldPiece);
00636   setPieceOf(num1,target);
00637   effects.template doEffect<NumBitmapEffect::Sub,false>(*this,newPtypeO,to,num0);
00638   setBoard(from,oldPiece);
00639   setBoard(to,target);
00640   effects.template doBlockAt<NumBitmapEffect::Sub,false>(*this,from,num0);
00641   effects.template doEffect<NumBitmapEffect::Add,false>(*this,capturePtypeO,to,num1);
00642   effects.template doEffect<NumBitmapEffect::Add,false>(*this,oldPtypeO,from,num0);
00643   effects.invalidateChangedEffects();
00644   pin_or_open = pin_or_open_backup;
00645   king_mobility = king_mobility_backup;
00646   promoted = promoted_backup;
00647   effects.effected_mask = effected_mask_backup;
00648   effects.effected_changed_mask = effected_changed_mask_backup;
00649   effects.mobilityTable = mobility_backup;
00650   king8infos = king8infos_backup;
00651 }
00652 
00653 
00654 #ifndef MINIMAL
00655 bool osl::state::NumEffectState::isConsistent(bool showError) const
00656 {
00657   if (!SimpleState::isConsistent(showError)) 
00658   {
00659     if (showError)
00660       std::cerr << "error before effect\n";
00661     return false;
00662   }
00663   effect::NumSimpleEffectTable effects1(*this);
00664   if (!(effects1==effects))
00665   {
00666     if (showError)
00667     {
00668       std::cerr << "Effect error 1" << std::endl;
00669       std::cerr << *this;
00670       for(int y=1;y<=9;y++)
00671         for(int x=9;x>0;x--)
00672         {
00673           Square pos(x,y);
00674           if (!(effects1.effectSetAt(pos)==effects.effectSetAt(pos)))
00675           {
00676             std::cerr << pos << ",real=" << effects.effectSetAt(pos) << ",ideal=" << effects1.effectSetAt(pos) << std::endl;
00677           }
00678         }
00679       for(int num=0;num<=39;num++){
00680         for(int i=0;i<8;i++){
00681           Direction d=static_cast<Direction>(i);
00682           if(effects.effectedNumTable[num][d]!=effects1.effectedNumTable[num][d]){
00683             std::cerr << "piece=" << pieceOf(num) << ",num=" << num << ",d=" << d << ",v1=" << effects.effectedNumTable[num][d] << ",v2=" << effects1.effectedNumTable[num][d] << std::endl;
00684           }
00685         }
00686       }
00687       std::cerr << effects.effectedNumTable << std::endl;
00688     }
00689     return false;
00690   }
00691   for (int z=0; z<2; ++z) {
00692     const Player p = indexToPlayer(z);
00693 #ifdef ALLOW_KING_ABSENCE
00694     if (kingSquare(p).isPieceStand())
00695       continue;
00696 #endif
00697     const PieceMask pin2 = effect_util::Pin::make(*this, p);
00698     if (pin(p) != pin2) {
00699       if (showError)
00700         std::cerr << "pin for " << p << " differs " << pin(p) << " " << pin2 << "\n";
00701       return false;
00702     }
00703     King8Info king8info2 = King8Info::make(alt(p), *this);
00704     if (King8Info(Iking8Info(p)).uint64Value() != king8info2.uint64Value()) {
00705       if (showError)
00706         std::cerr << "king8info for " << p << " differs \n" << King8Info(Iking8Info(p)) << "\n" << king8info2 << "\n";
00707       return false;
00708     }      
00709   }
00710   for (int i=0; i<Piece::SIZE; ++i) {
00711     const Piece p = pieceOf(i);
00712     if (p.isOnBoard()) {
00713       if (promoted.test(i) != p.isPromoted()) {
00714         if (showError)
00715           std::cerr << "promoted differs " << p << " " << promoted << " " << promoted.test(i) << "\n";
00716         return false;
00717       }
00718     }
00719   }
00720   return true;
00721 }
00722 #endif
00723 
00724 bool osl::state::NumEffectState::isConsistent(const NumEffectState& prev, Move moved, bool show_error) const
00725 {
00726   // test changedEffects
00727   const CArray<BoardMask,2> changed_squares
00728     = {{ changedEffects(BLACK), changedEffects(WHITE) }};
00729   const BoardMask changed_all = changed_squares[BLACK] | changed_squares[WHITE];
00730   CArray<BoardMask, Piece::SIZE> each_effect, prev_effect;
00731   for (int i=0; i<Piece::SIZE; ++i) {
00732     each_effect[i].clear();
00733     prev_effect[i].clear();
00734   }
00735   for (int x=1; x<=9; ++x) {
00736     for (int y=1; y<=9; ++y) {
00737       const Square sq(x, y);
00738       for (int i=0; i<Piece::SIZE; ++i) {
00739         if (effectSetAt(sq).test(i))
00740           each_effect[i].set(sq);
00741         if (prev.effectSetAt(sq).test(i))
00742           prev_effect[i].set(sq);
00743       }
00744       if (! changed_all.test(sq))
00745       {
00746         if (effectSetAt(sq) != prev.effectSetAt(sq)) {
00747 #ifndef MINIMAL
00748           if (show_error)
00749             std::cerr << "changedEffects unset\n" << *this << moved << sq << "\n";        
00750 #endif
00751           return false;
00752         }
00753       }
00754       for (int i=0; i<2; ++i) 
00755       {
00756         const Player pl = indexToPlayer(i);
00757         if (! changed_squares[pl].test(sq))
00758         {
00759           if ((effectSetAt(sq) & piecesOnBoard(pl))
00760               != (prev.effectSetAt(sq) & prev.piecesOnBoard(pl))) {
00761 #ifndef MINIMAL
00762             if (show_error)
00763               std::cerr << "changedEffects unset for " << pl << "\n" << *this << moved << sq << "\n";
00764 #endif
00765             return false;
00766           }
00767         }
00768       }
00769     }
00770   }
00771   // test changedPieces()
00772   const NumBitmapEffect changed_effect_pieces = changedPieces(); 
00773   for (int i=0; i<Piece::SIZE; ++i) {
00774     if (each_effect[i] == prev_effect[i])
00775       continue;
00776     if (! changed_effect_pieces.test(i)) {
00777 #ifndef MINIMAL
00778       if (show_error)
00779         std::cerr << "changedPieces() unset\n" << *this << moved << i 
00780                   << " " << each_effect[i] << " != " <<  prev_effect[i] << "\n";
00781 #endif
00782       return false;
00783     }
00784   }
00785   // test effectedChanged(Player pl)
00786   for (int i=0; i<Piece::SIZE; ++i) 
00787   {
00788     for (int j=0; j<2; ++j) 
00789     {
00790       const Player pl = indexToPlayer(j);
00791       if (prev.pieceOf(i).square() == moved.to())
00792         continue;               // captured
00793       if (prev.effectedMask(pl).test(i) != effectedMask(pl).test(i)) {
00794         if (! effectedChanged(pl).test(i)) {
00795 #ifndef MINIMAL
00796           if (show_error)
00797             std::cerr << "effectedChanged(" << pl << ") unset\n" << *this << moved << i 
00798                       << " " << prev.effectedChanged(pl) << " != " << prev.effectedChanged(WHITE) << "\n";
00799 #endif
00800           return false;
00801         }
00802       }
00803     }
00804   }
00805   return true;
00806 }
00807 
00808 template <bool show_error>
00809 bool
00810 #if (defined __GNUC__) && (! defined GPSONE) && (! defined GPSUSIONE)
00811 __attribute__ ((used,noinline))
00812 #endif
00813 osl::state::NumEffectState::isAlmostValidMove(Move move) const{
00814   assert(move.isValid());
00815   assert(move.isNormal());
00816   assert(this->turn() == move.player());
00817   assert(isValidMoveByRule(move, true));
00818 
00819   const Square from=move.from();
00820   if (from.isPieceStand()) // 打つ手
00821     return isAlmostValidDrop<show_error>(move);
00822   const Square to=move.to();
00823   const Piece from_piece = this->pieceAt(from);
00824     
00825   if (! testValidityOtherThanEffect<show_error>(move))
00826     return false;
00827   if(!hasEffectByPiece(from_piece,to)){
00828     if (show_error) {
00829       std::cerr << " No such move2 : " << move << std::endl;
00830     }
00831     return false;
00832   }
00833   return true;
00834 }
00835 
00836 bool osl::state::NumEffectState::
00837 isAlmostValidMove(Move move,bool show_error) const{
00838 #ifdef MINIMAL
00839   show_error=false;
00840 #endif
00841   if(show_error)
00842     return isAlmostValidMove<true>(move);
00843   else
00844     return isAlmostValidMove<false>(move);
00845 }
00846 
00847 #ifndef MINIMAL
00848 void osl::state::NumEffectState::showEffect(std::ostream& os) const
00849 {
00850   os<< static_cast<SimpleState const&>(*this);
00851   for(int y=1;y<=9;y++){
00852     os << 'P' << y;  
00853     for(int x=9;x>0;x--){
00854       Square pos(x,y);
00855       os << record::csa::show(pieceAt(pos)) << effectSetAt(pos);
00856     }
00857     os << std::endl;
00858   }
00859   // 持ち駒の表示
00860   for(int num=0;num<Piece::SIZE;num++){
00861     if (standMask(BLACK).test(num)){
00862       os << "P+00" << record::csa::show(Piece_Table.getPtypeOf(num))
00863          << std::endl;
00864     }
00865     else if (standMask(WHITE).test(num)){
00866       os << "P-00" << record::csa::show(Piece_Table.getPtypeOf(num))
00867          << std::endl;
00868     }
00869   }
00870 }
00871 #endif
00872 
00873 osl::container::PieceMask osl::state::NumEffectState::
00874 makePinOpen(osl::Square target,osl::Player defense)
00875 {
00876   PieceMask pins;
00877   if(target.isPieceStand()) return pins;
00878   PieceMask mask=piecesOnBoard(alt(defense));
00879   makePinOpenDir<UL>(target,pins,mask,defense);
00880   makePinOpenDir<U>(target,pins,mask,defense);
00881   makePinOpenDir<UR>(target,pins,mask,defense);
00882   makePinOpenDir<L>(target,pins,mask,defense);
00883   makePinOpenDir<R>(target,pins,mask,defense);
00884   makePinOpenDir<DL>(target,pins,mask,defense);
00885   makePinOpenDir<D>(target,pins,mask,defense);
00886   makePinOpenDir<DR>(target,pins,mask,defense);
00887   return pins;
00888 }
00889 
00890 void osl::state::NumEffectState::
00891 makePinOpen(osl::Player defense)
00892 {
00893   pin_or_open[defense]=makePinOpen(kingSquare(defense),defense);
00894 }
00895 
00896 const osl::mask_t osl::state::NumEffectState::
00897 allEffectAt(Player attack, Ptype ptype, Square target) const
00898 {
00899   switch (ptype) {
00900   case PAWN: case PPAWN:
00901     return allEffectAt<PAWN>(attack, target);
00902   case LANCE: case PLANCE:
00903     return allEffectAt<LANCE>(attack, target);
00904   case KNIGHT: case PKNIGHT:
00905     return allEffectAt<KNIGHT>(attack, target);
00906   case SILVER: case PSILVER:
00907     return allEffectAt<SILVER>(attack, target);
00908   case GOLD:
00909     return allEffectAt<GOLD>(attack, target);
00910   case BISHOP: case PBISHOP:
00911     return allEffectAt<BISHOP>(attack, target);
00912   case ROOK: case PROOK:
00913     return allEffectAt<ROOK>(attack, target);
00914   case KING:
00915     return allEffectAt<KING>(attack, target);
00916   default:
00917     assert(0);
00918   }
00919   return mask_t();
00920 }
00921 
00922 void osl::state::NumEffectState::copyFrom(const NumEffectState& src)
00923 {
00924 #ifndef MINIMAL
00925   (*this).used_mask=src.used_mask;
00926 #endif
00927   (*this).stand_mask=src.stand_mask;
00928 #if defined(__i386__) || defined(__x86_64__)
00929   {  
00930     v2di b16=*((v2di*)&src.board[16]);
00931     v2di b20=*((v2di*)&src.board[20]);
00932     v2di b24=*((v2di*)&src.board[24]);
00933     v2di b32=*((v2di*)&src.board[32]);
00934     v2di b36=*((v2di*)&src.board[36]);
00935     v2di b40=*((v2di*)&src.board[40]);
00936     v2di b48=*((v2di*)&src.board[48]);
00937     v2di b52=*((v2di*)&src.board[52]);
00938     v2di b56=*((v2di*)&src.board[56]);
00939 
00940     *((v2di*)&(*this).board[16])=b16;
00941     *((v2di*)&(*this).board[20])=b20;
00942     *((v2di*)&(*this).board[24])=b24;
00943     *((v2di*)&(*this).board[32])=b32;
00944     *((v2di*)&(*this).board[36])=b36;
00945     *((v2di*)&(*this).board[40])=b40;
00946     *((v2di*)&(*this).board[48])=b48;
00947     *((v2di*)&(*this).board[52])=b52;
00948     *((v2di*)&(*this).board[56])=b56;
00949 
00950 
00951     v2di b64=*((v2di*)&src.board[64]);
00952     v2di b68=*((v2di*)&src.board[68]);
00953     v2di b72=*((v2di*)&src.board[72]);
00954 
00955     v2di b80=*((v2di*)&src.board[80]);
00956     v2di b84=*((v2di*)&src.board[84]);
00957     v2di b88=*((v2di*)&src.board[88]);
00958 
00959     v2di b96=*((v2di*)&src.board[96]);
00960     v2di b100=*((v2di*)&src.board[100]);
00961     v2di b104=*((v2di*)&src.board[104]);
00962 
00963 
00964     *((v2di*)&(*this).board[64])=b64;
00965     *((v2di*)&(*this).board[68])=b68;
00966     *((v2di*)&(*this).board[72])=b72;
00967 
00968     *((v2di*)&(*this).board[80])=b80;
00969     *((v2di*)&(*this).board[84])=b84;
00970     *((v2di*)&(*this).board[88])=b88;
00971 
00972     *((v2di*)&(*this).board[96])=b96;
00973     *((v2di*)&(*this).board[100])=b100;
00974     *((v2di*)&(*this).board[104])=b104;
00975 
00976     v2di b112=*((v2di*)&src.board[112]);
00977     v2di b116=*((v2di*)&src.board[116]);
00978     v2di b120=*((v2di*)&src.board[120]);
00979 
00980     v2di b128=*((v2di*)&src.board[128]);
00981     v2di b132=*((v2di*)&src.board[132]);
00982     v2di b136=*((v2di*)&src.board[136]);
00983 
00984     v2di b144=*((v2di*)&src.board[144]);
00985     v2di b148=*((v2di*)&src.board[148]);
00986     v2di b152=*((v2di*)&src.board[152]);
00987 
00988     *((v2di*)&(*this).board[112])=b112;
00989     *((v2di*)&(*this).board[116])=b116;
00990     *((v2di*)&(*this).board[120])=b120;
00991 
00992     *((v2di*)&(*this).board[128])=b128;
00993     *((v2di*)&(*this).board[132])=b132;
00994     *((v2di*)&(*this).board[136])=b136;
00995 
00996     *((v2di*)&(*this).board[144])=b144;
00997     *((v2di*)&(*this).board[148])=b148;
00998     *((v2di*)&(*this).board[152])=b152;
00999 
01000     v2di p0=*((v2di*)&src.pieces[0]);
01001     v2di p4=*((v2di*)&src.pieces[4]);
01002     v2di p8=*((v2di*)&src.pieces[8]);
01003     v2di p12=*((v2di*)&src.pieces[12]);
01004     v2di p16=*((v2di*)&src.pieces[16]);
01005     v2di p20=*((v2di*)&src.pieces[20]);
01006     v2di p24=*((v2di*)&src.pieces[24]);
01007     v2di p28=*((v2di*)&src.pieces[28]);
01008     v2di p32=*((v2di*)&src.pieces[32]);
01009     v2di p36=*((v2di*)&src.pieces[36]);
01010     *((v2di*)&(*this).pieces[0])=p0;
01011     *((v2di*)&(*this).pieces[4])=p4;
01012     *((v2di*)&(*this).pieces[8])=p8;
01013     *((v2di*)&(*this).pieces[12])=p12;
01014     *((v2di*)&(*this).pieces[16])=p16;
01015     *((v2di*)&(*this).pieces[20])=p20;
01016     *((v2di*)&(*this).pieces[24])=p24;
01017     *((v2di*)&(*this).pieces[28])=p28;
01018     *((v2di*)&(*this).pieces[32])=p32;
01019     *((v2di*)&(*this).pieces[36])=p36;
01020   }
01021 #else
01022   for(int x=1;x<=9;x++)
01023     for(int y=1;y<=9;y++)
01024       (*this).board[Square(x,y).index()]=src.board[Square(x,y).index()];
01025   (*this).pieces=src.pieces;
01026 #endif
01027   (*this).pawnMask=src.pawnMask;
01028   this->stand_count = src.stand_count;
01029   this->player_to_move=src.player_to_move;
01030   effects.copyFrom(src.effects);
01031   this->pieces_onboard=src.pieces_onboard;
01032   (*this).promoted=src.promoted;
01033   (*this).pin_or_open=src.pin_or_open;
01034   (*this).king_mobility=src.king_mobility;
01035   (*this).king8infos=src.king8infos;
01036 }
01037 
01038 void osl::state::NumEffectState::copyFrom(const SimpleState& src)
01039 {
01040   copyFrom(NumEffectState(src));
01041 }
01042 
01043 namespace osl
01044 {
01045   // explicit template instantiation
01046 
01047   template bool NumEffectState:: 
01048   hasEffectByWithRemove<BLACK>(Square, Square) const;
01049   template bool NumEffectState:: 
01050   hasEffectByWithRemove<WHITE>(Square, Square) const;
01051   template void NumEffectState::makeKing8Info<BLACK>();
01052   template void NumEffectState::makeKing8Info<WHITE>();
01053 
01054 
01055   template void NumEffectState::
01056   prologueSimple(Player2Type<BLACK>, Square, Square, int, Piece&, int&, 
01057                  PtypeO&, PtypeO&, CArray<PieceMask,2>&, KingMobility&,
01058                  PieceMask&, CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01059                  CArray<uint64_t,2>&, MobilityTable&);
01060   template void NumEffectState::
01061   prologueSimple(Player2Type<WHITE>, Square, Square, int, Piece&, int&, 
01062                  PtypeO&, PtypeO&, CArray<PieceMask,2>&, KingMobility&,
01063                  PieceMask&, CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01064                  CArray<uint64_t,2>&, MobilityTable&);
01065 
01066   template void NumEffectState::
01067   prologueCapture(Player2Type<BLACK>, Square, Square, Piece, int, Piece&,
01068                   PtypeO&, PtypeO&, PtypeO&, int&, int&, int&, mask_t&,
01069                   CArray<PieceMask,2>&, KingMobility&, PieceMask&,
01070                   CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01071                   CArray<uint64_t,2>&, MobilityTable&);
01072   template void NumEffectState::
01073   prologueCapture(Player2Type<WHITE>, Square, Square, Piece, int, Piece&,
01074                   PtypeO&, PtypeO&, PtypeO&, int&, int&, int&, mask_t&,
01075                   CArray<PieceMask,2>&, KingMobility&, PieceMask&,
01076                   CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01077                   CArray<uint64_t,2>&, MobilityTable&);
01078 
01079   template void NumEffectState::
01080   prologueDrop(Player2Type<BLACK>, Square, Ptype, Piece&, int&, PtypeO&, 
01081                int&, mask_t&, CArray<PieceMask,2>&, KingMobility&,
01082                CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01083                CArray<uint64_t,2>&, MobilityTable&);
01084   template void NumEffectState::
01085   prologueDrop(Player2Type<WHITE>, Square, Ptype, Piece&, int&, PtypeO&, 
01086                int&, mask_t&, CArray<PieceMask,2>&, KingMobility&,
01087                CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01088                CArray<uint64_t,2>&, MobilityTable&);
01089 
01090   template void NumEffectState::
01091   epilogueCapture(Player2Type<BLACK>, Square, Square, Piece, Piece, PtypeO, PtypeO, 
01092                   PtypeO, int, int, int, mask_t, const CArray<PieceMask,2>&,
01093                   const KingMobility&, const PieceMask&, const CArray<PieceMask,2>&,
01094                   const CArray<PieceMask,2>&, const CArray<uint64_t,2>&,
01095                   const MobilityTable&);
01096   template void NumEffectState::
01097   epilogueCapture(Player2Type<WHITE>, Square, Square, Piece, Piece, PtypeO, PtypeO, 
01098                   PtypeO, int, int, int, mask_t, const CArray<PieceMask,2>&,
01099                   const KingMobility&, const PieceMask&, const CArray<PieceMask,2>&,
01100                   const CArray<PieceMask,2>&, const CArray<uint64_t,2>&,
01101                   const MobilityTable&);
01102   template void NumEffectState::
01103   epilogueDrop(Player2Type<BLACK>, Square, Ptype, Piece, int, PtypeO, int, mask_t,
01104                const CArray<PieceMask,2>&, const KingMobility&, const CArray<PieceMask,2>&,
01105                const CArray<PieceMask,2>&, const CArray<uint64_t,2>&, const MobilityTable&);
01106   template void NumEffectState::
01107   epilogueDrop(Player2Type<WHITE>, Square, Ptype, Piece, int, PtypeO, int, mask_t,
01108                const CArray<PieceMask,2>&, const KingMobility&, const CArray<PieceMask,2>&,
01109                const CArray<PieceMask,2>&, const CArray<uint64_t,2>&, const MobilityTable&);  
01110 
01111 }
01112 
01113 /* ------------------------------------------------------------------------- */
01114 // ;;; Local Variables:
01115 // ;;; mode:c++
01116 // ;;; c-basic-offset:2
01117 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines