00001
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
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;
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
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);
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);
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 #ifdef MINIMAL
00727 show_error=false;
00728 #endif
00729
00730 const CArray<BoardMask,2> changed_squares
00731 = {{ changedEffects(BLACK), changedEffects(WHITE) }};
00732 const BoardMask changed_all = changed_squares[BLACK] | changed_squares[WHITE];
00733 CArray<BoardMask, Piece::SIZE> each_effect, prev_effect;
00734 for (int i=0; i<Piece::SIZE; ++i) {
00735 each_effect[i].clear();
00736 prev_effect[i].clear();
00737 }
00738 for (int x=1; x<=9; ++x) {
00739 for (int y=1; y<=9; ++y) {
00740 const Square sq(x, y);
00741 for (int i=0; i<Piece::SIZE; ++i) {
00742 if (effectSetAt(sq).test(i))
00743 each_effect[i].set(sq);
00744 if (prev.effectSetAt(sq).test(i))
00745 prev_effect[i].set(sq);
00746 }
00747 if (! changed_all.test(sq))
00748 {
00749 if (effectSetAt(sq) != prev.effectSetAt(sq)) {
00750 #ifndef MINIMAL
00751 if (show_error)
00752 std::cerr << "changedEffects unset\n" << *this << moved << sq << "\n";
00753 #endif
00754 return false;
00755 }
00756 }
00757 for (int i=0; i<2; ++i)
00758 {
00759 const Player pl = indexToPlayer(i);
00760 if (! changed_squares[pl].test(sq))
00761 {
00762 if ((effectSetAt(sq) & piecesOnBoard(pl))
00763 != (prev.effectSetAt(sq) & prev.piecesOnBoard(pl))) {
00764 #ifndef MINIMAL
00765 if (show_error)
00766 std::cerr << "changedEffects unset for " << pl << "\n" << *this << moved << sq << "\n";
00767 #endif
00768 return false;
00769 }
00770 }
00771 }
00772 }
00773 }
00774
00775 const NumBitmapEffect changed_effect_pieces = changedPieces();
00776 for (int i=0; i<Piece::SIZE; ++i) {
00777 if (each_effect[i] == prev_effect[i])
00778 continue;
00779 if (! changed_effect_pieces.test(i)) {
00780 #ifndef MINIMAL
00781 if (show_error)
00782 std::cerr << "changedPieces() unset\n" << *this << moved << i
00783 << " " << each_effect[i] << " != " << prev_effect[i] << "\n";
00784 #endif
00785 return false;
00786 }
00787 }
00788
00789 for (int i=0; i<Piece::SIZE; ++i)
00790 {
00791 for (int j=0; j<2; ++j)
00792 {
00793 const Player pl = indexToPlayer(j);
00794 if (prev.pieceOf(i).square() == moved.to())
00795 continue;
00796 if (prev.effectedMask(pl).test(i) != effectedMask(pl).test(i)) {
00797 if (! effectedChanged(pl).test(i)) {
00798 #ifndef MINIMAL
00799 if (show_error)
00800 std::cerr << "effectedChanged(" << pl << ") unset\n" << *this << moved << i
00801 << " " << prev.effectedChanged(pl) << " != " << prev.effectedChanged(WHITE) << "\n";
00802 #endif
00803 return false;
00804 }
00805 }
00806 }
00807 }
00808 return true;
00809 }
00810
00811 template <bool show_error>
00812 bool
00813 #if (defined __GNUC__) && (! defined GPSONE) && (! defined GPSUSIONE)
00814 __attribute__ ((used,noinline))
00815 #endif
00816 osl::state::NumEffectState::isAlmostValidMove(Move move) const{
00817 assert(move.isValid());
00818 assert(move.isNormal());
00819 assert(this->turn() == move.player());
00820 assert(isValidMoveByRule(move, true));
00821
00822 const Square from=move.from();
00823 if (from.isPieceStand())
00824 return isAlmostValidDrop<show_error>(move);
00825 const Square to=move.to();
00826 const Piece from_piece = this->pieceAt(from);
00827
00828 if (! testValidityOtherThanEffect<show_error>(move))
00829 return false;
00830 if(!hasEffectByPiece(from_piece,to)){
00831 if (show_error) {
00832 std::cerr << " No such move2 : " << move << std::endl;
00833 }
00834 return false;
00835 }
00836 return true;
00837 }
00838
00839 bool osl::state::NumEffectState::
00840 isAlmostValidMove(Move move,bool show_error) const{
00841 #ifdef MINIMAL
00842 show_error=false;
00843 #endif
00844 if(show_error)
00845 return isAlmostValidMove<true>(move);
00846 else
00847 return isAlmostValidMove<false>(move);
00848 }
00849
00850 #ifndef MINIMAL
00851 void osl::state::NumEffectState::showEffect(std::ostream& os) const
00852 {
00853 os<< static_cast<SimpleState const&>(*this);
00854 for(int y=1;y<=9;y++){
00855 os << 'P' << y;
00856 for(int x=9;x>0;x--){
00857 Square pos(x,y);
00858 os << record::csa::show(pieceAt(pos)) << effectSetAt(pos);
00859 }
00860 os << std::endl;
00861 }
00862
00863 for(int num=0;num<Piece::SIZE;num++){
00864 if (standMask(BLACK).test(num)){
00865 os << "P+00" << record::csa::show(Piece_Table.getPtypeOf(num))
00866 << std::endl;
00867 }
00868 else if (standMask(WHITE).test(num)){
00869 os << "P-00" << record::csa::show(Piece_Table.getPtypeOf(num))
00870 << std::endl;
00871 }
00872 }
00873 }
00874 #endif
00875
00876 osl::container::PieceMask osl::state::NumEffectState::
00877 makePinOpen(osl::Square target,osl::Player defense)
00878 {
00879 PieceMask pins;
00880 if(target.isPieceStand()) return pins;
00881 PieceMask mask=piecesOnBoard(alt(defense));
00882 makePinOpenDir<UL>(target,pins,mask,defense);
00883 makePinOpenDir<U>(target,pins,mask,defense);
00884 makePinOpenDir<UR>(target,pins,mask,defense);
00885 makePinOpenDir<L>(target,pins,mask,defense);
00886 makePinOpenDir<R>(target,pins,mask,defense);
00887 makePinOpenDir<DL>(target,pins,mask,defense);
00888 makePinOpenDir<D>(target,pins,mask,defense);
00889 makePinOpenDir<DR>(target,pins,mask,defense);
00890 return pins;
00891 }
00892
00893 void osl::state::NumEffectState::
00894 makePinOpen(osl::Player defense)
00895 {
00896 pin_or_open[defense]=makePinOpen(kingSquare(defense),defense);
00897 }
00898
00899 const osl::mask_t osl::state::NumEffectState::
00900 allEffectAt(Player attack, Ptype ptype, Square target) const
00901 {
00902 switch (ptype) {
00903 case PAWN: case PPAWN:
00904 return allEffectAt<PAWN>(attack, target);
00905 case LANCE: case PLANCE:
00906 return allEffectAt<LANCE>(attack, target);
00907 case KNIGHT: case PKNIGHT:
00908 return allEffectAt<KNIGHT>(attack, target);
00909 case SILVER: case PSILVER:
00910 return allEffectAt<SILVER>(attack, target);
00911 case GOLD:
00912 return allEffectAt<GOLD>(attack, target);
00913 case BISHOP: case PBISHOP:
00914 return allEffectAt<BISHOP>(attack, target);
00915 case ROOK: case PROOK:
00916 return allEffectAt<ROOK>(attack, target);
00917 case KING:
00918 return allEffectAt<KING>(attack, target);
00919 default:
00920 assert(0);
00921 }
00922 return mask_t();
00923 }
00924
00925 void osl::state::NumEffectState::copyFrom(const NumEffectState& src)
00926 {
00927 #ifndef MINIMAL
00928 (*this).used_mask=src.used_mask;
00929 #endif
00930 (*this).stand_mask=src.stand_mask;
00931 #if defined(i386) || defined(__x86_64)
00932 {
00933 v2di b16=*((v2di*)&src.board[16]);
00934 v2di b20=*((v2di*)&src.board[20]);
00935 v2di b24=*((v2di*)&src.board[24]);
00936 v2di b32=*((v2di*)&src.board[32]);
00937 v2di b36=*((v2di*)&src.board[36]);
00938 v2di b40=*((v2di*)&src.board[40]);
00939 v2di b48=*((v2di*)&src.board[48]);
00940 v2di b52=*((v2di*)&src.board[52]);
00941 v2di b56=*((v2di*)&src.board[56]);
00942
00943 *((v2di*)&(*this).board[16])=b16;
00944 *((v2di*)&(*this).board[20])=b20;
00945 *((v2di*)&(*this).board[24])=b24;
00946 *((v2di*)&(*this).board[32])=b32;
00947 *((v2di*)&(*this).board[36])=b36;
00948 *((v2di*)&(*this).board[40])=b40;
00949 *((v2di*)&(*this).board[48])=b48;
00950 *((v2di*)&(*this).board[52])=b52;
00951 *((v2di*)&(*this).board[56])=b56;
00952
00953
00954 v2di b64=*((v2di*)&src.board[64]);
00955 v2di b68=*((v2di*)&src.board[68]);
00956 v2di b72=*((v2di*)&src.board[72]);
00957
00958 v2di b80=*((v2di*)&src.board[80]);
00959 v2di b84=*((v2di*)&src.board[84]);
00960 v2di b88=*((v2di*)&src.board[88]);
00961
00962 v2di b96=*((v2di*)&src.board[96]);
00963 v2di b100=*((v2di*)&src.board[100]);
00964 v2di b104=*((v2di*)&src.board[104]);
00965
00966
00967 *((v2di*)&(*this).board[64])=b64;
00968 *((v2di*)&(*this).board[68])=b68;
00969 *((v2di*)&(*this).board[72])=b72;
00970
00971 *((v2di*)&(*this).board[80])=b80;
00972 *((v2di*)&(*this).board[84])=b84;
00973 *((v2di*)&(*this).board[88])=b88;
00974
00975 *((v2di*)&(*this).board[96])=b96;
00976 *((v2di*)&(*this).board[100])=b100;
00977 *((v2di*)&(*this).board[104])=b104;
00978
00979 v2di b112=*((v2di*)&src.board[112]);
00980 v2di b116=*((v2di*)&src.board[116]);
00981 v2di b120=*((v2di*)&src.board[120]);
00982
00983 v2di b128=*((v2di*)&src.board[128]);
00984 v2di b132=*((v2di*)&src.board[132]);
00985 v2di b136=*((v2di*)&src.board[136]);
00986
00987 v2di b144=*((v2di*)&src.board[144]);
00988 v2di b148=*((v2di*)&src.board[148]);
00989 v2di b152=*((v2di*)&src.board[152]);
00990
00991 *((v2di*)&(*this).board[112])=b112;
00992 *((v2di*)&(*this).board[116])=b116;
00993 *((v2di*)&(*this).board[120])=b120;
00994
00995 *((v2di*)&(*this).board[128])=b128;
00996 *((v2di*)&(*this).board[132])=b132;
00997 *((v2di*)&(*this).board[136])=b136;
00998
00999 *((v2di*)&(*this).board[144])=b144;
01000 *((v2di*)&(*this).board[148])=b148;
01001 *((v2di*)&(*this).board[152])=b152;
01002
01003 v2di p0=*((v2di*)&src.pieces[0]);
01004 v2di p4=*((v2di*)&src.pieces[4]);
01005 v2di p8=*((v2di*)&src.pieces[8]);
01006 v2di p12=*((v2di*)&src.pieces[12]);
01007 v2di p16=*((v2di*)&src.pieces[16]);
01008 v2di p20=*((v2di*)&src.pieces[20]);
01009 v2di p24=*((v2di*)&src.pieces[24]);
01010 v2di p28=*((v2di*)&src.pieces[28]);
01011 v2di p32=*((v2di*)&src.pieces[32]);
01012 v2di p36=*((v2di*)&src.pieces[36]);
01013 *((v2di*)&(*this).pieces[0])=p0;
01014 *((v2di*)&(*this).pieces[4])=p4;
01015 *((v2di*)&(*this).pieces[8])=p8;
01016 *((v2di*)&(*this).pieces[12])=p12;
01017 *((v2di*)&(*this).pieces[16])=p16;
01018 *((v2di*)&(*this).pieces[20])=p20;
01019 *((v2di*)&(*this).pieces[24])=p24;
01020 *((v2di*)&(*this).pieces[28])=p28;
01021 *((v2di*)&(*this).pieces[32])=p32;
01022 *((v2di*)&(*this).pieces[36])=p36;
01023 }
01024 #else
01025 for(int x=1;x<=9;x++)
01026 for(int y=1;y<=9;y++)
01027 (*this).board[Square(x,y).index()]=src.board[Square(x,y).index()];
01028 (*this).pieces=src.pieces;
01029 #endif
01030 (*this).pawnMask=src.pawnMask;
01031 this->stand_count = src.stand_count;
01032 this->player_to_move=src.player_to_move;
01033 effects.copyFrom(src.effects);
01034 this->pieces_onboard=src.pieces_onboard;
01035 (*this).promoted=src.promoted;
01036 (*this).pin_or_open=src.pin_or_open;
01037 (*this).king_mobility=src.king_mobility;
01038 (*this).king8infos=src.king8infos;
01039 }
01040
01041 void osl::state::NumEffectState::copyFrom(const SimpleState& src)
01042 {
01043 copyFrom(NumEffectState(src));
01044 }
01045
01046 namespace osl
01047 {
01048
01049
01050 template bool NumEffectState::
01051 hasEffectByWithRemove<BLACK>(Square, Square) const;
01052 template bool NumEffectState::
01053 hasEffectByWithRemove<WHITE>(Square, Square) const;
01054 template void NumEffectState::makeKing8Info<BLACK>();
01055 template void NumEffectState::makeKing8Info<WHITE>();
01056
01057
01058 template void NumEffectState::
01059 prologueSimple(Player2Type<BLACK>, Square, Square, int, Piece&, int&,
01060 PtypeO&, PtypeO&, CArray<PieceMask,2>&, KingMobility&,
01061 PieceMask&, CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01062 CArray<uint64_t,2>&, MobilityTable&);
01063 template void NumEffectState::
01064 prologueSimple(Player2Type<WHITE>, Square, Square, int, Piece&, int&,
01065 PtypeO&, PtypeO&, CArray<PieceMask,2>&, KingMobility&,
01066 PieceMask&, CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01067 CArray<uint64_t,2>&, MobilityTable&);
01068
01069 template void NumEffectState::
01070 prologueCapture(Player2Type<BLACK>, Square, Square, Piece, int, Piece&,
01071 PtypeO&, PtypeO&, PtypeO&, int&, int&, int&, mask_t&,
01072 CArray<PieceMask,2>&, KingMobility&, PieceMask&,
01073 CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01074 CArray<uint64_t,2>&, MobilityTable&);
01075 template void NumEffectState::
01076 prologueCapture(Player2Type<WHITE>, Square, Square, Piece, int, Piece&,
01077 PtypeO&, PtypeO&, PtypeO&, int&, int&, int&, mask_t&,
01078 CArray<PieceMask,2>&, KingMobility&, PieceMask&,
01079 CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01080 CArray<uint64_t,2>&, MobilityTable&);
01081
01082 template void NumEffectState::
01083 prologueDrop(Player2Type<BLACK>, Square, Ptype, Piece&, int&, PtypeO&,
01084 int&, mask_t&, CArray<PieceMask,2>&, KingMobility&,
01085 CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01086 CArray<uint64_t,2>&, MobilityTable&);
01087 template void NumEffectState::
01088 prologueDrop(Player2Type<WHITE>, Square, Ptype, Piece&, int&, PtypeO&,
01089 int&, mask_t&, CArray<PieceMask,2>&, KingMobility&,
01090 CArray<PieceMask,2>&, CArray<PieceMask,2>&,
01091 CArray<uint64_t,2>&, MobilityTable&);
01092
01093 template void NumEffectState::
01094 epilogueCapture(Player2Type<BLACK>, Square, Square, Piece, Piece, PtypeO, PtypeO,
01095 PtypeO, int, int, int, mask_t, const CArray<PieceMask,2>&,
01096 const KingMobility&, const PieceMask&, const CArray<PieceMask,2>&,
01097 const CArray<PieceMask,2>&, const CArray<uint64_t,2>&,
01098 const MobilityTable&);
01099 template void NumEffectState::
01100 epilogueCapture(Player2Type<WHITE>, Square, Square, Piece, Piece, PtypeO, PtypeO,
01101 PtypeO, int, int, int, mask_t, const CArray<PieceMask,2>&,
01102 const KingMobility&, const PieceMask&, const CArray<PieceMask,2>&,
01103 const CArray<PieceMask,2>&, const CArray<uint64_t,2>&,
01104 const MobilityTable&);
01105 template void NumEffectState::
01106 epilogueDrop(Player2Type<BLACK>, Square, Ptype, Piece, int, PtypeO, int, mask_t,
01107 const CArray<PieceMask,2>&, const KingMobility&, const CArray<PieceMask,2>&,
01108 const CArray<PieceMask,2>&, const CArray<uint64_t,2>&, const MobilityTable&);
01109 template void NumEffectState::
01110 epilogueDrop(Player2Type<WHITE>, Square, Ptype, Piece, int, PtypeO, int, mask_t,
01111 const CArray<PieceMask,2>&, const KingMobility&, const CArray<PieceMask,2>&,
01112 const CArray<PieceMask,2>&, const CArray<uint64_t,2>&, const MobilityTable&);
01113
01114 }
01115
01116
01117
01118
01119
01120