All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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: