checkmate.h
Go to the documentation of this file.
1 /* checkmate.h
2  */
3 #ifndef _CHECKMATE_H
4 #define _CHECKMATE_H
5 
6 #include "osl/rating/feature.h"
9 
10 namespace osl
11 {
12  namespace rating
13  {
14  class CheckmateIfCapture : public Feature
15  {
16  public:
18  bool match(const NumEffectState& state, Move move, const RatingEnv&) const
19  {
20  return state.hasEffectAt(alt(move.player()), move.to())
23  (const_cast<NumEffectState&>(state), move, 0); // XXX: evil cast
24  }
25  };
26 
27  class Threatmate : public Feature
28  {
29  public:
30  Threatmate() : Feature("Tm") {}
31  bool match(const NumEffectState& state, Move move, const RatingEnv&) const;
32  struct Helper;
33 
34  static bool isCandidate(const NumEffectState& state, Move move);
35  static bool knight2Step(const NumEffectState& state, Move move, Square king);
36  static bool captureForKnightCheck(const NumEffectState& state, Move move, Square king);
37  };
38 
39  }
40 }
41 
42 
43 #endif /* _CHECKMATE_H */
44 // ;;; Local Variables:
45 // ;;; mode:c++
46 // ;;; c-basic-offset:2
47 // ;;; End:
bool match(const NumEffectState &state, Move move, const RatingEnv &) const
Definition: checkmate.h:18
bool hasEffectAt(Square target) const
対象とするマスにあるプレイヤーの利きがあるかどうか.
constexpr Player alt(Player player)
Definition: basic_type.h:13
static bool effectiveAttackCandidate0(const NumEffectState &state, Move move)
depth==0でeffectiveAttackになる可能性がなければfalse
圧縮していない moveの表現 .
Definition: basic_type.h:1051
Player player() const
Definition: basic_type.h:1195
利きを持つ局面
const Square to() const
Definition: basic_type.h:1132
static bool effectiveAttack(NumEffectState &state, Move move, int depth)
move を指した後,alt(move.player())が取ると詰みかどうか.