3 #ifndef OSL_QUIESCENCEGENERATOR_H
4 #define OSL_QUIESCENCEGENERATOR_H
18 #include <boost/foreach.hpp>
34 template <Ptype PTYPE,
bool has_dont_capture>
35 static void capture(
const NumEffectState&,
40 static void capture(
const NumEffectState&,
45 static void capture1(
const NumEffectState& state,
46 Square target, MoveVector& moves)
50 static void promote(
const NumEffectState&, PieceMask pins,
52 template <Ptype PTYPE>
53 static void promote(
const NumEffectState&, MoveVector& moves);
54 template <Ptype PTYPE,
size_t N>
55 static void promoteN(
const NumEffectState&, MoveVector& moves,
57 static void check(
const NumEffectState&, PieceMask pins,
58 MoveVector& moves,
bool no_liberty=
false);
59 static void check(
const NumEffectState&, PieceMask pins,
bool no_liberty,
60 const Square8& sendoffs, MoveVector& moves);
61 static void escapeKing(
const NumEffectState& state, MoveVector& moves);
65 static bool escapeKingInTakeBack(
const NumEffectState& state, MoveVector& moves,
bool check_by_lance);
66 static void dropMajorPiece(
const NumEffectState& state, MoveVector& moves);
67 static void dropMajorPiece3(
const NumEffectState& state, MoveVector& moves,
72 static void escapeAll(
const NumEffectState& state, MoveVector& moves);
78 bool add_support_only=
false);
82 template <
class EvalT>
84 Move last_move, MoveVector& moves);
85 template <
class EvalT>
87 Move last_move, MoveVector& moves);
92 Piece piece, MoveVector& moves);
94 PieceMask pins, MoveVector& moves);
96 PieceMask pins,
Square attack_from,
97 bool has_knight, MoveVector& moves);
99 PieceMask pins, MoveVector& moves);
101 PieceMask pins, MoveVector& moves);
107 template <Direction DIR>
109 const Square from, MoveVector& moves);
110 static void attackKing8(
const NumEffectState& state, PieceMask pins,
112 static void attackToPinned(
const NumEffectState& state, PieceMask pins,
120 Move threatmate, PieceMask pins,
122 static void kingWalk(
const NumEffectState& state,
126 const MoveVector& src,
130 const MoveVector& all_moves,
132 MoveVector& expensive_drops);
134 const MoveVector& src,
136 MoveVector& open_out,
145 template <osl::Player P>
152 BOOST_FOREACH(
Move m, moves)
153 assert(! ShouldPromoteCut::canIgnoreMove<P>(m));
157 template <osl::Player P>
158 template <osl::Ptype PTYPE>
166 template <osl::Player P>
167 template <osl::Ptype PTYPE,
size_t N>
174 FixedCapacityVector<std::pair<int,Move>, 16*2> selected;
175 BOOST_FOREACH(
Move m, all) {
176 if (state.hasEffectAt(
alt(P), m.
to()))
178 selected.push_back(std::make_pair(table.
value(m), m));
180 std::sort(selected.begin(), selected.end());
181 for (
size_t i=0; i<
std::min(N, selected.size()); ++i)
182 moves.push_back(selected[selected.size()-1-i].second);