My Project
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:
osl::Square
Definition: basic_type.h:532
immediateCheckmate.h
osl::alt
constexpr Player alt(Player player)
Definition: basic_type.h:13
osl::checkmate::CheckmateIfCapture::effectiveAttackCandidate0
static bool effectiveAttackCandidate0(const NumEffectState &state, Move move)
depth==0でeffectiveAttackになる可能性がなければfalse
Definition: checkmateIfCapture.cc:21
osl::rating::Threatmate::isCandidate
static bool isCandidate(const NumEffectState &state, Move move)
Definition: checkmate.cc:61
osl::Move
圧縮していない moveの表現 .
Definition: basic_type.h:1052
osl::NumEffectState::hasEffectAt
bool hasEffectAt(Square target) const
対象とするマスにあるプレイヤーの利きがあるかどうか.
Definition: numEffectState.h:324
osl::rating::Feature
Definition: rating/feature.h:15
osl::rating::RatingEnv
Definition: ratingEnv.h:16
osl::rating::CheckmateIfCapture
Definition: checkmate.h:15
osl::rating::CheckmateIfCapture::CheckmateIfCapture
CheckmateIfCapture()
Definition: checkmate.h:17
osl::checkmate::CheckmateIfCapture::effectiveAttack
static bool effectiveAttack(NumEffectState &state, Move move, int depth)
move を指した後,alt(move.player())が取ると詰みかどうか.
Definition: checkmateIfCapture.cc:120
osl::rating::Threatmate::captureForKnightCheck
static bool captureForKnightCheck(const NumEffectState &state, Move move, Square king)
Definition: checkmate.cc:36
osl::rating::Threatmate
Definition: checkmate.h:28
osl::rating::Threatmate::match
bool match(const NumEffectState &state, Move move, const RatingEnv &) const
Definition: checkmate.cc:94
osl::NumEffectState
利きを持つ局面
Definition: numEffectState.h:34
checkmateIfCapture.h
osl::rating::Threatmate::knight2Step
static bool knight2Step(const NumEffectState &state, Move move, Square king)
Definition: checkmate.cc:25
osl::Move::to
const Square to() const
Definition: basic_type.h:1132
osl::rating::CheckmateIfCapture::match
bool match(const NumEffectState &state, Move move, const RatingEnv &) const
Definition: checkmate.h:18
osl::rating::Threatmate::Threatmate
Threatmate()
Definition: checkmate.h:30
osl::Move::player
Player player() const
Definition: basic_type.h:1195
osl
Definition: additionalEffect.h:6
feature.h