checkmate.h
Go to the documentation of this file.
00001 /* checkmate.h
00002  */
00003 #ifndef _CHECKMATE_H
00004 #define _CHECKMATE_H
00005 
00006 #include "osl/rating/feature.h"
00007 #include "osl/checkmate/immediateCheckmate.h"
00008 #include "osl/checkmate/checkmateIfCapture.h"
00009 
00010 namespace osl
00011 {
00012   namespace rating
00013   {
00014     class CheckmateIfCapture : public Feature
00015     {
00016     public:
00017       CheckmateIfCapture() : Feature("CC") {}
00018       bool match(const NumEffectState& state, Move move, const RatingEnv&) const
00019       {
00020         return state.hasEffectAt(alt(move.player()), move.to())
00021           && checkmate::CheckmateIfCapture::effectiveAttackCandidate0(state, move)
00022           && checkmate::CheckmateIfCapture::effectiveAttack
00023           (const_cast<NumEffectState&>(state), move, 0); // XXX: evil cast
00024       }
00025     };
00026 
00027     class Threatmate : public Feature
00028     {
00029     public:
00030       Threatmate() : Feature("Tm") {}
00031       bool match(const NumEffectState& state, Move move, const RatingEnv&) const;
00032       struct Helper;
00033 
00034       static bool isCandidate(const NumEffectState& state, Move move);
00035       static bool knight2Step(const NumEffectState& state, Move move, Square king);
00036       static bool captureForKnightCheck(const NumEffectState& state, Move move, Square king);
00037     };
00038 
00039   }
00040 }
00041 
00042 
00043 #endif /* _CHECKMATE_H */
00044 // ;;; Local Variables:
00045 // ;;; mode:c++
00046 // ;;; c-basic-offset:2
00047 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines