escape_.cc
Go to the documentation of this file.
#include "osl/move_generator/escape_.h"
#include "osl/move_generator/escape_.tcc"
#include "osl/move_generator/pieceOnBoard.tcc"
#ifdef NDEBUG
# include "osl/move_generator/capture_.tcc"
#endif
#include "osl/numEffectState.h"
void osl::GenerateEscapeKing::generate(const NumEffectState& state, MoveVector& out)
{
const size_t first = out.size();
{
typedef move_action::Store store_t;
store_t store(out);
const Piece king =state.kingPiece(state.turn());
move_generator::GenerateEscapeOfTurn::generate(state, king, store);
}
MoveVector unpromote_moves;
const size_t last = out.size();
for (size_t i=first; i<last; ++i)
{
if(out[i].hasIgnoredUnpromote())
unpromote_moves.push_back(out[i].unpromote());
}
out.push_back(unpromote_moves.begin(), unpromote_moves.end());
}
void osl::GenerateEscapeKing::generateCheap(const NumEffectState& state, MoveVector& out)
{
if (state.turn() == BLACK)
move_generator::GenerateEscape<BLACK>::generateCheapKingEscape(state, out);
else
move_generator::GenerateEscape<WHITE>::generateCheapKingEscape(state, out);
}
namespace osl
{
// explicit template instantiation
namespace move_generator
{
template class Escape<move_action::Store>;
template void Escape<move_action::Store>::generate<BLACK,true,false>(const NumEffectState& state,Piece piece,move_action::Store& action);
template void Escape<move_action::Store>::generate<WHITE,true,false>(const NumEffectState& state,Piece piece,move_action::Store& action);
template void Escape<move_action::Store>::generateMoves<BLACK,true>(NumEffectState const&, Piece, Piece, move_action::Store&);
template void Escape<move_action::Store>::generateMoves<WHITE,true>(NumEffectState const&, Piece, Piece, move_action::Store&);
template void Escape<move_action::Store>::generateKingEscape<BLACK, false>(NumEffectState const&, move_action::Store&);
template void Escape<move_action::Store>::generateKingEscape<WHITE, false>(NumEffectState const&, move_action::Store&);
template void Escape<move_action::Store>::generateKingEscape<BLACK, true>(NumEffectState const&, move_action::Store&);
template void Escape<move_action::Store>::generateKingEscape<WHITE, true>(NumEffectState const&, move_action::Store&);
template void Escape<move_action::Store>::generateBlockingKing<BLACK,false>(const NumEffectState&,Piece,Square,move_action::Store&);
template void Escape<move_action::Store>::generateBlockingKing<WHITE,false>(const NumEffectState&,Piece,Square,move_action::Store&);
template void Escape<move_action::Store>::generateBlocking<BLACK,true>(const NumEffectState&,Piece,Square,Square,move_action::Store&);
template void Escape<move_action::Store>::generateBlocking<WHITE,true>(const NumEffectState&,Piece,Square,Square,move_action::Store&);
} // namespace move_generator
} // namespace osl
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
capture_.tcc
osl::FixedCapacityVector::size
size_t size() const
Definition container.h:243
osl::FixedCapacityVector::end
iterator end()
Definition container.h:199
osl::FixedCapacityVector::push_back
void push_back(const T &e)
Definition container.h:204
osl::FixedCapacityVector::begin
iterator begin()
Definition container.h:198
osl::MoveVector
Definition container.h:293
osl::NumEffectState
利きを持つ局面
Definition numEffectState.h:34
osl::Piece
駒.
Definition basic_type.h:788
osl::SimpleState::kingPiece
const Piece kingPiece() const
Definition simpleState.h:83
osl::SimpleState::turn
Player turn() const
Definition simpleState.h:220
osl::Square
Definition basic_type.h:532
osl::move_generator::Escape::generateKingEscape
static void generateKingEscape(const NumEffectState &state, Action &action)
osl::move_generator::Escape::generateBlocking
static void generateBlocking(const NumEffectState &state, Piece p, Square to, Square from, Action &action)
Square toにある玉以外の駒pにfromにある駒から王手がかかってい る時に，長い利きの途中に入る手を 生成する(合駒，駒移動)． breakThreatmateから直接呼ばれる．
osl::move_generator::Escape::generate
static void generate(const NumEffectState &state, Piece piece, Action &action)
attacker からの利きを逃れる.
osl::move_generator::Escape::generateMoves
static void generateMoves(const NumEffectState &state, Piece piece, Piece attacker, Action &action)
attacker からの利きを逃れる.
osl::move_generator::Escape::generateBlockingKing
static void generateBlockingKing(const NumEffectState &state, Piece p, Square from, Action &action)
玉pにfromにある駒から王手がかかってい る時に，長い利きの途中に入る手を 生成する(合駒，駒移動)． breakThreatmateから直接呼ばれる．
escape_.h
escape_.tcc
osl::move_generator
Definition addEffectWithEffect.cc:10
osl
Definition additionalEffect.h:6
osl::unpromote
Ptype unpromote(Ptype ptype)
ptypeがpromote後の型の時に，promote前の型を返す． promoteしていない型の時はそのまま返す
Definition basic_type.h:157
osl::BLACK
@ BLACK
Definition basic_type.h:9
numEffectState.h
pieceOnBoard.tcc
osl::GenerateEscapeKing::generate
static void generate(const NumEffectState &state, MoveVector &out)
不成の受けも作成
Definition escape_.cc:9
osl::GenerateEscapeKing::generateCheap
static void generateCheap(const NumEffectState &state, MoveVector &out)
Definition escape_.cc:28
osl::move_action::Store
指手を MoveVector に保管
Definition move_action.h:16
osl::move_generator::GenerateEscapeOfTurn::generate
static void generate(const NumEffectState &state, Piece piece, Action &a)
Definition escape_.h:145
osl::move_generator::GenerateEscape::generateCheapKingEscape
static void generateCheapKingEscape(const NumEffectState &state, FixedCapacityVector< Move, Capacity > &out)
Definition escape_.h:136