{ { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } { { { { { { { { { { { { { { } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } */ bool { { { { } } } } } } } } } } } } } } { #else #if 0 osl:: osl:: else else else else else else else else #endif #endif #endif #endif #endif #endif #endif #endif #endif #endif #endif #endif #endif #endif #endif #endif #endif { { } } } } } } } else{ else{ else{ else else { else { else { { { { } } } } } } default: int num; bool osl:: { } } } return; return; return; } // ;;; End: case GOLD: case KING: numIndex=0; namespace osl assert(0); return pins; return true; return true; return true; #ifdef MINIMAL continue; continue; changeTurn(); #ifndef MINIMAL #ifndef MINIMAL #ifndef MINIMAL #ifndef MINIMAL #ifndef MINIMAL #ifndef MINIMAL #ifndef MINIMAL #ifndef MINIMAL // ;;; mode:c++ return true; PtypeO ptypeO; if (inCheck()) if(show_error) return false; return false; return false; return false; return false; return false; return false; return false; return false; return false; return false; return false; Piece oldPiece; Piece oldPiece; Piece oldPiece; PieceMask pins; if (ret >= 0) { mask_t numMask; template Piece template Piece return true; if (showError) if (showError) if (inCheck()) { if (promoteMask) if (promoteMask) if (ptype==PAWN) mask_t num1Mask; return mask_t(); switch (ptype) { return false; return false; return false; makeMovePass(); makePinOpen(P); makePinOpen(P); return primDir(d) show_error=false; #ifndef DFPNSTATONE #include }); if (showError) if (showError) changed.set(to); changed.set(to); changed.set(to); os << std::endl; if (effect.none()) if (lance.any()) { if (pieces.any()) if (pieces.any()) if(turn()==BLACK){ if(turn()==BLACK){ int num, numIndex; /* numEffectState.cc typedef __v2di v2di; return false; if (show_error) if (pieces.any()) if (pieces.any()) if (plance.any()) if (show_error) { os << 'P' << y; if (! effect.any()) if (turn()==BLACK){ makePinOpen(BLACK); makePinOpen(WHITE); << std::endl; << std::endl; if (showError) Square pos(x,y); // 確認が必要 changed.set(from); changed.set(from); promoted.set(num); const int index = 0; if (move.isPass()) { newPiece+=(to-from); newPiece+=(to-from); promoted.resetAll(); setBoard(to,target); #if OSL_WORDSIZE == 64 #include const osl::Piece osl:: const osl::Piece osl:: return false; return false; Direction lastD=UL; Direction lastD=UL; Direction lastD=UL; Direction lastD=UL; Direction lastD=UL; Direction lastD=UL; if (p.isOnBoard()){ pieces &= ~ppieces; pieces &= ~ppieces; promoted.set(num0); setPawn(turn(),to); // 持ち駒の表示 assert(! inCheck(P)); for(int x=1;x<=9;x++) generateLegal(moves); num1=target.number(); promoted.reset(num1); // ;;; Local Variables: // ;;; c-basic-offset:2 template template template template template template if (p.isOnBoard()) { return pieceOf(num); return pieceOf(ret); // test changedEffects case PAWN: case PPAWN: case ROOK: case PROOK: for(int y=1;y<=9;y++){ num=oldPiece.number(); oldPiece=pieceOf(num); return Piece::EMPTY(); setBoard(to,newPiece); setBoard(to,newPiece); setBoard(to,newPiece); #elif OSL_WORDSIZE == 32 return false; if (show_error) if (show_error) if (p.isPromoted()) std::cerr << *this; MoveVector all_moves; Piece p=pieceOf(num); for(int x=9;x>0;x--){ for(int y=1;y<=9;y++) if (pin(p) != pin2) { if (promoted.any()) { // test changedPieces() assert(move.isValid()); if (capturePtype==PAWN) num0=oldPiece.number(); oldPiece=pieceAt(from); oldPiece=pieceAt(from); #ifdef ALLOW_KING_ABSENCE #ifdef ALLOW_KING_ABSENCE Square pos(x,y); promoted.set(num); if (notpromoted.any()) return Piece::EMPTY(); Piece newPiece=oldPiece; assert(move.isNormal()); case LANCE: case PLANCE: effect.clearBit(); if (from.isPieceStand()) setBoard(from,oldPiece); setBoard(from,oldPiece); setPieceOf(num1,target); bool osl::NumEffectState:: template void osl::NumEffectState:: void osl::NumEffectState:: void osl::NumEffectState:: void osl::NumEffectState:: void osl::NumEffectState:: void osl::NumEffectState:: void osl::NumEffectState:: void osl::NumEffectState:: void osl::NumEffectState:: void osl::NumEffectState:: void osl::NumEffectState:: if (show_error) for(int i=0;i<2;i++){ for(int y=1;y<=9;y++) clearPawn(turn(),from); clearPawn(turn(),from); each_effect[i].clear(); makeKing8Info(); makeKing8Info(); prev_effect[i].clear(); const Player altP=alt(P); for (int z=0; z<2; ++z) { if (!(effects1==effects)) if(hasEffectAt(BLACK,to)) if(hasEffectAt(BLACK,to)) if(hasEffectAt(BLACK,to)) if(hasEffectAt(WHITE,to)) if(hasEffectAt(WHITE,to)) ptypeO=newPiece.ptypeO(); setPieceOf(num,newPiece); setPieceOf(num,newPiece); setPieceOf(num,oldPiece); setPieceOf(num,oldPiece); for(int x=9;x>0;x--) const Square sq(x, y); return pieceOf(ret); for (int j=0; j<2; ++j) ret = std::max(pp, npp); (*this).pieces=src.pieces; PieceMask promoted_backup; PieceMask promoted_backup; case BISHOP: case PBISHOP: case KNIGHT: case PKNIGHT: case SILVER: case PSILVER: const Square to=move.to(); const Square to=move.to(); const mask_t ownMochigoma= for (int x=1; x<=9; ++x) { if (hasEffectAt(WHITE,to)) if (last_move.isCapture()) int num0, num1, num1Index; int pp=-1, npp=-1, ret=-1; setPieceOf(num0,newPiece); setPieceOf(num0,oldPiece); [&](Move m){ for(int i=0;i<8;i++){ makeKing8Info(); makeKing8Info(); makeKing8Info(); makeKing8Info(); makeKing8Info(); makeKing8Info(); if (last_move.isCapture() assert(ownMochigoma.any()); if (! last_move.isNormal()) num = numLow|(numIndex<<5); promoted = promoted_backup; promoted = promoted_backup; promoted_backup = promoted; promoted_backup = promoted; for (int i=0; i<2; ++i) clearPawn(alt(turn()),to); for (int y=1; y<=9; ++y) { pin_or_open[P].reset(num); recalcPinOpen(to,lastD,P); recalcPinOpen(to,lastD,P); recalcPinOpen(to,lastD,P); PtypeO oldPtypeO, newPtypeO; for(int num=0;num<40;num++){ oldPtypeO=oldPiece.ptypeO(); oldPtypeO=oldPiece.ptypeO(); setBoard(to,Piece::EMPTY()); setBoard(to,Piece::EMPTY()); #include "osl/simpleState.tcc" const Move move = moves[i]; const Piece p = pieceOf(i); pin_or_open[P].reset(num0); : SimpleState(st),effects(st) king8infos_backup=king8infos; newPiece+=to-Square::STAND(); new_ptypeo=newPiece.ptypeO(); new_ptypeo=newPiece.ptypeO(); pieces_onboard[0].resetAll(); pieces_onboard[1].resetAll(); #include "osl/numEffectState.h" __attribute__ ((used,noinline)) int promoteMask, doDropMove(to,move.ptype()); recalcPinOpen(from,lastD,P); recalcPinOpen(from,lastD,P); (*this).pawnMask=src.pawnMask; (*this).promoted=src.promoted; capturePtypeO=target.ptypeO(); const Square from=move.from(); const Square from=move.from(); copyFrom(NumEffectState(src)); effects.clearChangedEffects(); effects.clearChangedEffects(); effects.clearChangedEffects(); effects.copyFrom(src.effects); move_action::Store store(out); setBoard(from,Piece::EMPTY()); setBoard(from,Piece::EMPTY()); template void NumEffectState:: template void NumEffectState:: template void NumEffectState:: template void NumEffectState:: template void NumEffectState:: template void NumEffectState:: template void NumEffectState:: template void NumEffectState:: template void NumEffectState:: template void NumEffectState:: makePinOpen(osl::Player defense) each_effect[i].set(sq); prev_effect[i].set(sq); if (! changed_all.test(sq)) pp = promoted.bsr() + i*32; assert(st1.isConsistent(true)); assert(st2.isConsistent(true)); effects.clearEffectedChanged(); effects.clearEffectedChanged(); effects.clearEffectedChanged(); king8infos = king8infos_backup; king8infos = king8infos_backup; king8infos = king8infos_backup; king8infos_backup = king8infos; king8infos_backup = king8infos; template bool NumEffectState:: template bool NumEffectState:: #include "osl/numEffectState.tcc" doDropMove(Square to,Ptype ptype) (*this).used_mask=src.used_mask; assert(isAlmostValidMove(move)); assert(turn() == move.player()); forEachEffect(P, target, store); if (last_move.ptype() == KING) { int numLow = ownMochigoma.bsf(); using namespace move_classifier; using namespace move_classifier; using namespace move_classifier; using namespace move_classifier; using namespace move_classifier; NumEffectState::~NumEffectState() Player pl=indexToPlayer(i); for(int num=0;num<=39;num++){ if (captured != Piece::EMPTY()) if (move.hasIgnoredUnpromote()) pin_or_open[alt(P)].reset(num); recalcPinOpen(to,lastD,alt(P)); recalcPinOpen(to,lastD,alt(P)); recalcPinOpen(to,lastD,alt(P)); // 自分自身の効きを外す numMask=ownMochigoma.lowestBit(); pin_or_open = pin_or_open_backup; pin_or_open = pin_or_open_backup; pin_or_open = pin_or_open_backup; pin_or_open_backup = pin_or_open; pin_or_open_backup = pin_or_open; pin_or_open_backup = pin_or_open; if (effectSetAt(sq).test(i)) *((v2di*)&(*this).pieces[0])=p0; *((v2di*)&(*this).pieces[4])=p4; *((v2di*)&(*this).pieces[8])=p8; if (standMask(BLACK).test(num)){ mask_t all = nolance.getMask(i); pin_or_open[alt(P)].reset(num0); (*this).king8infos=src.king8infos; (*this).stand_mask=src.stand_mask; // explicit template instantiation // test effectedChanged(Player pl) KingMobility king_mobility_backup; KingMobility king_mobility_backup; KingMobility king_mobility_backup; for (int i=0; i().isPieceStand()) if (oldPtypeO == newPtypeO(P,KING)) if (oldPtypeO == newPtypeO(P,KING)) if(kingSquare().isOnBoard()) if(kingSquare().isOnBoard()) pieces = effect.selectBit(); return King8Info(Iking8Info(king)); setPieceOf(num1,target.captured()); const osl::checkmate::King8Info osl:: if(hasEffectAt(pl,p.square())) *((v2di*)&(*this).pieces[12])=p12; *((v2di*)&(*this).pieces[16])=p16; *((v2di*)&(*this).pieces[20])=p20; *((v2di*)&(*this).pieces[24])=p24; *((v2di*)&(*this).pieces[28])=p28; *((v2di*)&(*this).pieces[32])=p32; *((v2di*)&(*this).pieces[36])=p36; const Player p = indexToPlayer(z); v2di b16=*((v2di*)&src.board[16]); v2di b20=*((v2di*)&src.board[20]); v2di b24=*((v2di*)&src.board[24]); v2di b32=*((v2di*)&src.board[32]); v2di b36=*((v2di*)&src.board[36]); v2di b40=*((v2di*)&src.board[40]); v2di b48=*((v2di*)&src.board[48]); v2di b52=*((v2di*)&src.board[52]); v2di b56=*((v2di*)&src.board[56]); v2di b64=*((v2di*)&src.board[64]); v2di b68=*((v2di*)&src.board[68]); v2di b72=*((v2di*)&src.board[72]); v2di b80=*((v2di*)&src.board[80]); v2di b84=*((v2di*)&src.board[84]); v2di b88=*((v2di*)&src.board[88]); v2di b96=*((v2di*)&src.board[96]); (*this).pin_or_open=src.pin_or_open; effects.effected_mask[0].resetAll(); effects.effected_mask[1].resetAll(); for (int i=lance_index; i>=0; --i) { if (pieces.none() || ppieces.none()) num1Mask=PieceMask::numToMask(num1); return pieceOf(std::min(num, nump)); this->stand_count = src.stand_count; *((v2di*)&(*this).board[100])=b100; *((v2di*)&(*this).board[104])=b104; *((v2di*)&(*this).board[112])=b112; *((v2di*)&(*this).board[116])=b116; *((v2di*)&(*this).board[120])=b120; *((v2di*)&(*this).board[128])=b128; *((v2di*)&(*this).board[132])=b132; *((v2di*)&(*this).board[136])=b136; *((v2di*)&(*this).board[144])=b144; *((v2di*)&(*this).board[148])=b148; *((v2di*)&(*this).board[152])=b152; v2di p12=*((v2di*)&src.pieces[12]); v2di p16=*((v2di*)&src.pieces[16]); v2di p20=*((v2di*)&src.pieces[20]); v2di p24=*((v2di*)&src.pieces[24]); v2di p28=*((v2di*)&src.pieces[28]); v2di p32=*((v2di*)&src.pieces[32]); v2di p36=*((v2di*)&src.pieces[36]); CArray king8infos_backup; CArray king8infos_backup; CArray king8infos_backup; const Piece piece = pieceOnBoard(to); for(int num=0;numturn() == move.player()); effect_action::StorePiece store(&out); effects.effectedNumTable[num].clear(); effects.effectedNumTable[num].clear(); effects.effectedNumTable[num].clear(); if(target.isPieceStand()) return pins; mobility::MobilityTable mobilityTable; mobility::MobilityTable mobilityTable; mobility::MobilityTable mobilityTable; num1Index=PieceMask::numToIndex(num1); #include "osl/move_generator/allMoves.h" if (prev.effectSetAt(sq).test(i)) const Player pl = indexToPlayer(j); for (int i=0; i(move); CArray pin_or_open_backup; CArray pin_or_open_backup; CArray pin_or_open_backup; effects.effectedNumTable[num0].clear(); effects.effectedNumTable[num1].clear(); mask_t king = effect.selectBit(); standMask(P).xorMask(numIndex,numMask); standMask(P).xorMask(numIndex,numMask); #include "osl/move_classifier/safeMove.h" void osl::NumEffectState::makeKing8Info() Piece& oldPiece, int& num, PieceMask& promoted_backup, effects.effected_mask[BLACK].set(num); effects.effected_mask[BLACK].set(num); effects.effected_mask[WHITE].set(num); effects.effected_mask[WHITE].set(num); if (! changed_effect_pieces.test(i)) { return isAlmostValidMove(move); (*this).king_mobility=src.king_mobility; const Ptype capturePtype=target.ptype(); effects.mobilityTable = mobility_backup; effects.mobilityTable = mobility_backup; effects.mobilityTable = mobility_backup; mobility_backup = effects.mobilityTable; mobility_backup = effects.mobilityTable; mobility_backup = effects.mobilityTable; stand_count[P][ptype-PTYPE_BASIC_MIN]++; stand_count[P][ptype-PTYPE_BASIC_MIN]--; this->pieces_onboard=src.pieces_onboard; this->player_to_move=src.player_to_move; PieceMask& promoted_backup, const Player pl = indexToPlayer(i); if (! changed_squares[pl].test(sq)) std::cerr << "error before effect\n"; effects.effected_mask[BLACK].set(num0); effects.effected_mask[WHITE].set(num0); CArray effected_mask_backup; CArray effected_mask_backup; CArray effected_mask_backup; const CArray changed_squares effects.effected_mask[BLACK].reset(num1); effects.effected_mask[WHITE].reset(num1); if (!(st1.king8infos == st2.king8infos)) mask_t lance = pieces.selectBit(); standMask(P).xorMask(num1Index,num1Mask); standMask(P).xorMask(num1Index,num1Mask); #include "osl/move_generator/move_action.h" MobilityTable &mobility_backup) int& numIndex, mask_t& numMask, effects.effected_mask[i].set(num); continue; // captured if (! effectedChanged(pl).test(i)) { const Piece captured = pieceOnBoard(to); effects.effected_mask[BLACK].reset(num); effects.effected_mask[BLACK].reset(num); effects.effected_mask[WHITE].reset(num); effects.effected_mask[WHITE].reset(num); // あるいは自分自身のブロック effects.setChangedPieces(effectSetAt(to)); pieces = effect.getMask(index) & ~ppieces; #include "osl/move_classifier/moveAdaptor.h" NumEffectState::king8Info(Player king) const effects.effected_mask[BLACK].reset(num0); effects.effected_mask[WHITE].reset(num0); if (ret >= PtypeTraits::indexMin) return allEffectAt(attack, target); return allEffectAt(attack, target); return allEffectAt(attack, target); return allEffectAt(attack, target); PieceMask mask=piecesOnBoard(alt(defense)); PtypeO oldPtypeO, capturePtypeO, newPtypeO; if (!(st1.pin_or_open == st2.pin_or_open)) if (!SimpleState::isConsistent(showError)) #include "osl/move_generator/effect_action.h" void osl::NumEffectState::makeMove(Move move) MobilityTable &mobility_backup) && !Board_Table.isBetweenSafe(from, to, return allEffectAt(attack, target); effects.effected_changed_mask[0].resetAll(); effects.effected_changed_mask[1].resetAll(); if (! pin(alt(turn())).test(piece.number())) makePinOpenDir(target,pins,mask,defense); makePinOpenDir(target,pins,mask,defense); makePinOpenDir(target,pins,mask,defense); makePinOpenDir(target,pins,mask,defense); os<< static_cast(*this); pieces_onboard[P].xorMask(numIndex,numMask); pieces_onboard[P].xorMask(numIndex,numMask); return (static_cast(st1) kingSquare(alt(turn()))) MobilityTable &mobility_backup) int num1Index, mask_t num1Mask, doSimpleMove(from,to,move.promoteMask()); if (promoted.test(i) != p.isPromoted()) { GenerateEscapeKing::generate(*this, moves); return allEffectAt(attack, target); return allEffectAt(attack, target); return allEffectAt(attack, target); return isAlmostValidDrop(move); return pieceOf(lance.bsr()+lance_index*32); const Piece from_piece = this->pieceAt(from); effect::NumSimpleEffectTable effects1(*this); effected_mask_backup = effects.effected_mask; effected_mask_backup = effects.effected_mask; effected_mask_backup = effects.effected_mask; effects.effected_mask = effected_mask_backup; effects.effected_mask = effected_mask_backup; effects.effected_mask = effected_mask_backup; makePinOpenDir
(target,pins,mask,defense); makePinOpenDir(target,pins,mask,defense); makePinOpenDir
    (target,pins,mask,defense); makePinOpenDir(target,pins,mask,defense); bool osl::operator==(const NumEffectState& st1, const PieceMask& promoted_backup, KingMobility& king_mobility_backup, Direction d=static_cast(i); assert(Piece_Table.getPtypeOf(ret) == PAWN); ppieces = pieces & promoted.getMask(); effects.effected_changed_mask[BLACK].set(num); effects.effected_changed_mask[BLACK].set(num); effects.effected_changed_mask[WHITE].set(num); effects.effected_changed_mask[WHITE].set(num); const PieceMask& promoted_backup, int& num1Index, mask_t& num1Mask, if (prev.pieceOf(i).square() == moved.to()) std::cerr << "Effect error 1" << std::endl; // そうでなければ全ての手を生成 ppieces = pieces & promoted.getMask(); effects.effected_changed_mask[BLACK].set(num0); effects.effected_changed_mask[WHITE].set(num0); for (int i=0, iend=moves.size(); i& king8infos_backup, == static_cast(st2)); if ((effectSetAt(sq) & piecesOnBoard(pl)) CArray effected_changed_mask_backup; CArray effected_changed_mask_backup; CArray effected_changed_mask_backup; if (!(st1.pieces_onboard == st2.pieces_onboard)) NumEffectState::findThreatenedPiece(Player P) const isAlmostValidMove(Move move,bool show_error) const{ makePinOpen(osl::Square target,osl::Player defense) CArray&, MobilityTable&); CArray&, MobilityTable&); effects.effected_changed_mask[i].set(num); mask_t pieces = effect.selectBit(), ppieces; prologueDrop(Player2Type

    , Square to, Ptype ptype, const MobilityTable &mobility_backup) CArray& king8infos_backup, PtypeO& oldPtypeO, PtypeO& new_ptypeo, const MobilityTable & mobility_backup) CArray& pin_or_open_backup, return hasEffectIf(last_move.capturePtypeO(), to, const int num = pieces.bsf(), nump = ppieces.bsf(); hasEffectByWithRemove(Square, Square) const; hasEffectByWithRemove(Square, Square) const; pieces_onboard[alt(P)].xorMask(num1Index,num1Mask); pieces_onboard[alt(P)].xorMask(num1Index,num1Mask); NumEffectState::wasCheckEvasion(Move last_move) const bool osl::NumEffectState::isSafeMove(Move move) const doSimpleMove(Square from, Square to, int promoteMask) const NumEffectState& st2) CArray&, MobilityTable&); CArray&, MobilityTable&); CArray& king8infos_backup, PtypeO newPtypeO, int num0, int num1, const KingMobility& king_mobility_backup, if (effectSetAt(sq) != prev.effectSetAt(sq)) { pin_or_open[P].reset(num1); // captured is not pin if (! testValidityOtherThanEffect(move)) NumEffectState::NumEffectState(const SimpleState& st) bool osl::NumEffectState::isOpenCheck(Move move) const CArray&, MobilityTable&); CArray&, MobilityTable&); CArray& pin_or_open_backup, CArray& effected_mask_backup, Piece newPiece=oldPiece.promoteWithMask(promoteMask); Piece newPiece=oldPiece.promoteWithMask(promoteMask); template void NumEffectState::makeKing8Info(); template void NumEffectState::makeKing8Info(); epilogueSimple(Square from, Square to, Piece oldPiece, oldPiece, num, oldPtypeO, newPtypeO, oldPiece, num, oldPtypeO, newPtypeO, CArray& pin_or_open_backup, const KingMobility& king_mobility_backup, Piece& oldPiece, int& num, PtypeO& ptypeO, || pin_or_open[BLACK]!=pin_or_open_backup[BLACK]) || pin_or_open[BLACK]!=pin_or_open_backup[BLACK]) || pin_or_open[BLACK]!=pin_or_open_backup[BLACK]) || pin_or_open[WHITE]!=pin_or_open_backup[WHITE]) || pin_or_open[WHITE]!=pin_or_open_backup[WHITE]) || pin_or_open[WHITE]!=pin_or_open_backup[WHITE]) os << csa::show(pieceAt(pos)) << effectSetAt(pos); mask_t promoted = all & promotedPieces().getMask(i); PieceMask nolance = pieces; nolance.clearBit(); NumEffectState::selectCheapPiece(PieceMask effect) const bool osl::NumEffectState::isDirectCheck(Move move) const osl::NumEffectState::isAlmostValidMove(Move move) const{ const KingMobility& king_mobility_backup, CArray& effected_mask_backup, const CArray& king8infos_backup, doCaptureMove(from,to,captured,move.promoteMask()); std::cerr << effects.effectedNumTable << std::endl; = {{ changedEffects(BLACK), changedEffects(WHITE) }}; GenerateAllMoves::generate(turn(), *this, all_moves); return PlayerMoveAdaptor::isMember(*this, move); pin_or_open_backup, king_mobility_backup, pin_or_open_backup, king_mobility_backup, CArray& effected_mask_backup, PtypeO& new_ptypeo, int& num0, int& num1, CArray&, CArray&, CArray&, CArray&, King8Info king8info2 = King8Info::make(alt(p), *this); CArray each_effect, prev_effect; void osl::NumEffectState::copyFrom(const SimpleState& src) const CArray& king8infos_backup, int num, PtypeO oldPtypeO, PtypeO newPtypeO, const CArray& pin_or_open_backup, pin_or_open[alt(P)].reset(num1); // captured is not pin if (last_move.isDrop() || last_move.oldPtype() == KNIGHT) if (promoteMask!=0 && num0::indexLimit) return ConditionAdaptor::isMember(*this, move); findEffect(Player P, Square target, PieceVector& out) const pin_or_open_backup, king_mobility_backup, pin_or_open_backup, king_mobility_backup, const CArray& king8infos_backup, && hasEffectIf(last_move.capturePtypeO(), to, from)) os << "P+00" << csa::show(Piece_Table.getPtypeOf(num)) os << "P-00" << csa::show(Piece_Table.getPtypeOf(num)) std::cerr << " No such move2 : " << move << std::endl; const PieceMask pin2 = effect_util::Pin::make(*this, p); return pieceOf(king.bsf()+PtypeFuns::indexNum*32); const Square from = last_move.from(), to = last_move.to(); if (promoteMask!=0 && num < PtypeTraits::indexLimit) ppieces = effect.getMask(index) & promoted.getMask(index); return ConditionAdaptor::isMember(*this, move); allEffectAt(Player attack, Ptype ptype, Square target) const bool osl::NumEffectState::isConsistent(bool showError) const void osl::NumEffectState::showEffect(std::ostream& os) const kingSquare(alt(turn()))); pin_or_open_backup, king_mobility_backup, pin_or_open_backup, king_mobility_backup, CArray&, CArray&, CArray&, CArray&, const CArray& pin_or_open_backup, const CArray& effected_mask_backup, // 自分自身がブロックしていたpromote?の延長 PieceMask pieces = piecesOnBoard(P) & effectedMask(alt(P)); void osl::NumEffectState::copyFrom(const NumEffectState& src) const CArray& pin_or_open_backup, effects.doBlockAt(*this,to,num); bool osl::NumEffectState::isPawnDropCheckmate(Move move) const const CArray& effected_mask_backup, CArray& effected_changed_mask_backup, return pieceOf(ppieces.bsf()+PtypeFuns::indexNum*32); effected_changed_mask_backup = effects.effected_changed_mask; effected_changed_mask_backup = effects.effected_changed_mask; effected_changed_mask_backup = effects.effected_changed_mask; effects.effected_changed_mask = effected_changed_mask_backup; effects.effected_changed_mask = effected_changed_mask_backup; effects.effected_changed_mask = effected_changed_mask_backup; return PlayerMoveAdaptor::isMember(*this, move); const CArray& effected_mask_backup, return pieceOf(pieces.bsf()+PtypeFuns::indexNum*32); prologueSimple(Player2Type(), from, to, promoteMask, prologueSimple(Player2Type(), from, to, promoteMask, return pieceOf(pieces.any() ? pieces.bsf() : ppieces.bsf()); return pieceOf(ppieces.bsf()+PtypeFuns::indexNum*32); effects.doBlockAt(*this,from,num); effects.effectedNumTable[num0]=effects.effectedNumTable[num1]; effects.effectedNumTable[num1]=effects.effectedNumTable[num0]; pin_or_open[defense]=makePinOpen(kingSquare(defense),defense); void osl::NumEffectState::generateLegal(MoveVector& moves) const CArray& effected_changed_mask_backup, return pieceOf(pieces.bsf()+PtypeFuns::indexNum*32); const NumBitmapEffect changed_effect_pieces = changedPieces(); CArray&, KingMobility&, PieceMask&, CArray&, KingMobility&, PieceMask&, CArray& effected_changed_mask_backup, int&, mask_t&, CArray&, KingMobility&, int&, mask_t&, CArray&, KingMobility&, int num, PtypeO ptypeO, int numIndex, mask_t numMask, BoardMask changed=changedEffects(BLACK)|changedEffects(WHITE); BoardMask changed=changedEffects(BLACK)|changedEffects(WHITE); BoardMask changed=changedEffects(BLACK)|changedEffects(WHITE); mask_t plance = lance & promotedPieces().getMask(lance_index); if (Piece_Table.getPtypeOf(num) == Piece_Table.getPtypeOf(nump)) void osl::NumEffectState::generateAllUnsafe(MoveVector& out) const != (prev.effectSetAt(sq) & prev.piecesOnBoard(pl))) { standMask(P).getMask(numIndex) & Ptype_Table.getMaskLow(ptype); NumEffectState::safeCaptureNotByKing(Square, Piece) const; NumEffectState::safeCaptureNotByKing(Square, Piece) const; doCaptureMove(Square from, Square to, Piece target, int promoteMask) const CArray& effected_changed_mask_backup, if (!(effects1.effectSetAt(pos)==effects.effectSetAt(pos))) return PlayerMoveAdaptor::isMember(*this, move); #if (defined __GNUC__) && (! defined GPSONE) && (! defined GPSUSIONE) epilogueDrop(Player2Type

    , Square to, Ptype ptype, Piece oldPiece, std::cerr << "changedPieces() unset\n" << *this << moved << i if (prev.effectedMask(pl).test(i) != effectedMask(pl).test(i)) { effects.template doBlockAt(*this,to,num); effects.template doBlockAt(*this,to,num); #if (defined(__i386__) || defined(__x86_64__)) && !defined(OSL_NO_SSE) #if (defined(__i386__) || defined(__x86_64__)) && !defined(OSL_NO_SSE) epilogueCapture(Player2Type

    , Square from, Square to, Piece target, prologueCapture(Player2Type

    , Square from, Square to, Piece target, PtypeO&, PtypeO&, PtypeO&, int&, int&, int&, mask_t&, PtypeO&, PtypeO&, PtypeO&, int&, int&, int&, mask_t&, PtypeO&, PtypeO&, CArray&, KingMobility&, PtypeO&, PtypeO&, CArray&, KingMobility&, const CArray& effected_changed_mask_backup, effects.doEffect(*this,newPtypeO,to,num); effects.template doBlockAt(*this,to,num); stand_count[P][unpromote(getPtype(capturePtypeO))-PTYPE_BASIC_MIN]++; stand_count[P][unpromote(getPtype(capturePtypeO))-PTYPE_BASIC_MIN]--; prologueSimple(Player2Type

    , Square from, Square to, int promoteMask, const CArray&, const CArray&, const CArray&, const CArray&, PieceMask&, CArray&, CArray&, PieceMask&, CArray&, CArray&, Piece oldPiece, PtypeO oldPtypeO, PtypeO capturePtypeO, const CArray& effected_changed_mask_backup, (*this).board[Square(x,y).index()]=src.board[Square(x,y).index()]; if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare())) if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare())) if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare())) if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare())) if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare())) if(changed.anyInRange(Board_Mask_Table3x3.mask(kingSquare())) effects.template doBlockAt(*this,from,num); prologueSimple(Player2Type, Square, Square, int, Piece&, int&, prologueSimple(Player2Type, Square, Square, int, Piece&, int&, notpromoted &= ~Ptype_Table.getMaskLow(Piece_Table.getPtypeOf(pp)); !=primDirUnsafe(Board_Table.getShort8Unsafe(piece.owner(), from,to)); effects.doEffect(*this,oldPtypeO,from,num); effects.template doBlockAt(*this,from,num0); prologueCapture(Player2Type, Square, Square, Piece, int, Piece&, prologueCapture(Player2Type, Square, Square, Piece, int, Piece&, prologueDrop(Player2Type, Square, Ptype, Piece&, int&, PtypeO&, prologueDrop(Player2Type, Square, Ptype, Piece&, int&, PtypeO&, effects.template doBlockAt(*this,from,num0); Piece& oldPiece, PtypeO& oldPtypeO, PtypeO& capturePtypeO, const int lance_index = PtypeFuns::indexNum; // 64bit: 0, 32bit: 1 king8infos[P]=King8Info::make(*this,kingSquare

    ()).uint64Value(); PtypeO, int, int, int, mask_t, const CArray&, PtypeO, int, int, int, mask_t, const CArray&, effects.template doEffect(*this,ptypeO,to,num); if (King8Info(Iking8Info(p)).uint64Value() != king8info2.uint64Value()) { effects.template doEffect(*this,ptypeO,to,num); capturePtypeO, newPtypeO, num0, num1, num1Index,num1Mask, capturePtypeO, newPtypeO, num0, num1, num1Index,num1Mask, std::copy_if(all_moves.begin(), all_moves.end(), std::back_inserter(moves), move_generator::AllMoves::generate(turn(), *this, store); /* ------------------------------------------------------------------------- */ void osl::NumEffectState::generateWithFullUnpromotions(MoveVector& moves) const return this->isSafeMove(m) && ! this->isPawnDropCheckmate(m); << " " << each_effect[i] << " != " << prev_effect[i] << "\n"; const BoardMask changed_all = changed_squares[BLACK] | changed_squares[WHITE]; effects.template doEffect(*this,new_ptypeo,to,num); effects.template doEffect(*this,new_ptypeo,to,num0); effects.template doEffect(*this,newPtypeO,to,num0); effects.template doEffect(*this,oldPtypeO,from,num); if(effects.effectedNumTable[num][d]!=effects1.effectedNumTable[num][d]){ effects.template doEffect(*this,oldPtypeO,from,num0); epilogueDrop(Player2Type, Square, Ptype, Piece, int, PtypeO, int, mask_t, epilogueDrop(Player2Type, Square, Ptype, Piece, int, PtypeO, int, mask_t, effects.template doEffect(*this,oldPtypeO,from,num0); const KingMobility&, const PieceMask&, const CArray&, const KingMobility&, const PieceMask&, const CArray&, effects.template doEffect(*this,capturePtypeO,to,num1); epilogueCapture(Player2Type, Square, Square, Piece, Piece, PtypeO, PtypeO, epilogueCapture(Player2Type, Square, Square, Piece, Piece, PtypeO, PtypeO, std::cerr << "pin for " << p << " differs " << pin(p) << " " << pin2 << "\n"; effects.template doEffect(*this,capturePtypeO,to,num1); std::cerr << "effectedChanged(" << pl << ") unset\n" << *this << moved << i const CArray&, const KingMobility&, const CArray&, const CArray&, const KingMobility&, const CArray&, const CArray&, const CArray&, const MobilityTable&); std::cerr << "changedEffects unset\n" << *this << moved << sq << "\n"; prologueDrop(Player2Type(), to, ptype, oldPiece, num, ptypeO, numIndex, numMask, prologueDrop(Player2Type(), to, ptype, oldPiece, num, ptypeO, numIndex, numMask, const CArray&, const CArray&, const MobilityTable&); // この指手は,玉の素抜きがあったり,打歩詰の可能性があるので prologueCapture(Player2Type(), from, to, target, promoteMask, oldPiece, oldPtypeO, prologueCapture(Player2Type(), from, to, target, promoteMask, oldPiece, oldPtypeO, // 王手がかかっている時は防ぐ手のみを生成, 王手回避は不成も生成 // depends on current piece numbers: , KE 18, GI 22, KI 26, , , KA 36, HI 38, effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable); effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable); std::cerr << "changedEffects unset for " << pl << "\n" << *this << moved << sq << "\n"; bool osl::NumEffectState::isConsistent(const NumEffectState& prev, Move moved, bool show_error) const std::cerr << "promoted differs " << p << " " << promoted << " " << promoted.test(i) << "\n"; << " " << prev.effectedChanged(pl) << " != " << prev.effectedChanged(WHITE) << "\n"; std::cerr << "king8info for " << p << " differs \n" << King8Info(Iking8Info(p)) << "\n" << king8info2 << "\n"; promoted_backup, effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable); promoted_backup, effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable); promoted_backup, effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable); promoted_backup, effected_mask_backup, effected_changed_mask_backup,king8infos_backup,mobilityTable); std::cerr << pos << ",real=" << effects.effectSetAt(pos) << ",ideal=" << effects1.effectSetAt(pos) << std::endl; std::cerr << "piece=" << pieceOf(num) << ",num=" << num << ",d=" << d << ",v1=" << effects.effectedNumTable[num][d] << ",v2=" << effects1.effectedNumTable[num][d] << std::endl;